Struct maud::Escaper
[−]
[src]
pub struct Escaper<'a>(_);
An adapter that escapes HTML special characters.
The following characters are escaped:
&
is escaped as&
<
is escaped as<
>
is escaped as>
"
is escaped as"
All other characters are passed through unchanged.
Note: In versions prior to 0.13, the single quote ('
) was
escaped as well.
Example
use std::fmt::Write; let mut s = String::new(); write!(Escaper::new(&mut s), "<script>launchMissiles()</script>").unwrap(); assert_eq!(s, "<script>launchMissiles()</script>");
Methods
impl<'a> Escaper<'a>
[src]
Trait Implementations
impl<'a> Write for Escaper<'a>
[src]
fn write_str(&mut self, s: &str) -> Result
Writes a slice of bytes into this writer, returning whether the write succeeded. Read more
fn write_char(&mut self, c: char) -> Result<(), Error>
1.1.0
Writes a char
into this writer, returning whether the write succeeded. Read more
fn write_fmt(&mut self, args: Arguments) -> Result<(), Error>
1.0.0
Glue for usage of the write!
macro with implementors of this trait. Read more