pub trait Encoder {
type Error;
// Required methods
fn write_unescaped(&mut self, part: &str) -> Result<(), Self::Error>;
fn write_escaped(&mut self, part: &str) -> Result<(), Self::Error>;
fn write_html<'b, I: Iterator<Item = Event<'b>>>(
&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§
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<'b, I: Iterator<Item = Event<'b>>>(
&mut self,
iter: I,
) -> Result<(), Self::Error>
fn write_html<'b, I: Iterator<Item = Event<'b>>>( &mut self, iter: I, ) -> Result<(), Self::Error>
Write HTML from an Iterator of pulldown_cmark Events.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".