Struct maud::Escaper [] [src]

pub struct Escaper<W> { /* fields omitted */ }

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;
  • ' is escaped as &#39;

All other characters are passed through unchanged.

Example

use std::fmt::Write;
let mut escaper = Escaper::new(String::new());
write!(escaper, "<script>launchMissiles()</script>").unwrap();
assert_eq!(escaper.into_inner(), "&lt;script&gt;launchMissiles()&lt;/script&gt;");Run

Methods

impl<W> Escaper<W>
[src]

Creates an Escaper from a std::fmt::Write.

Extracts the inner writer.

Trait Implementations

impl<W: Write> Write for Escaper<W>
[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