pub trait Escaper: Copy {
// Required method
fn write_escaped_str<W: Write>(&self, dest: W, string: &str) -> Result;
// Provided method
fn write_escaped_char<W: Write>(&self, dest: W, c: char) -> Result { ... }
}Expand description
Escapers are used to make generated text safe for printing in some context.
E.g. in an Html context, any and all generated text can be used in HTML/XML text nodes and
attributes, without for for maliciously injected data.
Required Methods§
Sourcefn write_escaped_str<W: Write>(&self, dest: W, string: &str) -> Result
fn write_escaped_str<W: Write>(&self, dest: W, string: &str) -> Result
Escaped the input string string into dest
Provided Methods§
Sourcefn write_escaped_char<W: Write>(&self, dest: W, c: char) -> Result
fn write_escaped_char<W: Write>(&self, dest: W, c: char) -> Result
Escaped the input char c into dest
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.