Trait skyline_web::encoding::Encoder
source · 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
Required Methods
sourcefn write_unescaped(&mut self, part: &str) -> Result<(), Self::Error>
fn write_unescaped(&mut self, part: &str) -> Result<(), Self::Error>
Write a &str to this Encoder in plain mode.
sourcefn write_escaped(&mut self, part: &str) -> Result<(), Self::Error>
fn write_escaped(&mut self, part: &str) -> Result<(), Self::Error>
Write a &str to this Encoder, escaping special HTML characters.
sourcefn write_html<'a, I>(&mut self, iter: I) -> Result<(), Self::Error>where
I: Iterator<Item = Event<'a>>,
fn write_html<'a, I>(&mut self, iter: I) -> Result<(), Self::Error>where
I: Iterator<Item = Event<'a>>,
Write HTML from an Iterator of pulldown_cmark Events.