Struct maud::Escaper[][src]

pub struct Escaper<'a>(_);
Expand description

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;");

Implementations

Creates an Escaper from a String.

Trait Implementations

Writes a string slice 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

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Performs the conversion.

Converts self into a collection.

Should always be Self

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

Get the TypeId of this object.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more