pub trait Encoder {
    type Error;

    fn write_unescaped(&mut self, part: &str) -> Result<(), Self::Error>;
    fn write_escaped(&mut self, part: &str) -> Result<(), Self::Error>;
    fn write_html<'a, I>(&mut self, iter: I) -> Result<(), Self::Error>
    where
        I: Iterator<Item = Event<'a>>
; fn format_unescaped<D>(&mut self, display: D) -> Result<(), Self::Error>
    where
        D: Display
; fn format_escaped<D>(&mut self, display: D) -> Result<(), Self::Error>
    where
        D: Display
; }
Expand description

A trait that wraps around either a String or std::io::Write, providing UTF-8 safe writing boundaries and special HTML character escaping.

Required Associated Types

Error type for this encoder

Required Methods

Write a &str to this Encoder in plain mode.

Write a &str to this Encoder, escaping special HTML characters.

Write HTML from an Iterator of pulldown_cmark Events.

Write a Display implementor to this Encoder in plain mode.

Write a Display implementor to this Encoder, escaping special HTML characters.

Implementations on Foreign Types

Implementors