Struct maud::Escaper [] [src]

pub struct Escaper<'a>(_);

An adapter that escapes HTML special characters.

The following characters are escaped:

  • & is escaped as &amp;
  • < is escaped as &lt;
  • > is escaped as &gt;
  • " is escaped as &quot;

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, "&lt;script&gt;launchMissiles()&lt;/script&gt;");

Methods

impl<'a> Escaper<'a>
[src]

Creates an Escaper from a String.

Trait Implementations

impl<'a> Write for Escaper<'a>
[src]

Writes a slice of bytes into this writer, returning whether the write succeeded. Read more

Writes a char into this writer, returning whether the write succeeded. Read more

Glue for usage of the write! macro with implementors of this trait. Read more