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: Iterator<Item = Event<'a>>>(
&mut self,
iter: I
) -> Result<(), Self::Error>;
fn format_unescaped<D: Display>(
&mut self,
display: D
) -> Result<(), Self::Error>;
fn format_escaped<D: Display>(
&mut self,
display: D
) -> Result<(), Self::Error>;
}
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
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
Event
s.
Write a Display
implementor to this Encoder
in plain mode.