html5ever::serialize

Trait Serializer

Source
pub trait Serializer {
    // Required methods
    fn start_elem<'a, AttrIter>(
        &mut self,
        name: QualName,
        attrs: AttrIter,
    ) -> Result<(), Error>
       where AttrIter: Iterator<Item = (&'a QualName, &'a str)>;
    fn end_elem(&mut self, name: QualName) -> Result<(), Error>;
    fn write_text(&mut self, text: &str) -> Result<(), Error>;
    fn write_comment(&mut self, text: &str) -> Result<(), Error>;
    fn write_doctype(&mut self, name: &str) -> Result<(), Error>;
    fn write_processing_instruction(
        &mut self,
        target: &str,
        data: &str,
    ) -> Result<(), Error>;
}
Expand description

Types that are capable of serializing implement this trait

Required Methods§

Source

fn start_elem<'a, AttrIter>( &mut self, name: QualName, attrs: AttrIter, ) -> Result<(), Error>
where AttrIter: Iterator<Item = (&'a QualName, &'a str)>,

Serialize the start of an element, for example <div class="test">.

Source

fn end_elem(&mut self, name: QualName) -> Result<(), Error>

Serialize the end of an element, for example </div>.

Source

fn write_text(&mut self, text: &str) -> Result<(), Error>

Serialize a plain text node.

Source

fn write_comment(&mut self, text: &str) -> Result<(), Error>

Serialize a comment node, for example <!-- comment -->.

Source

fn write_doctype(&mut self, name: &str) -> Result<(), Error>

Serialize a doctype node, for example <!doctype html>.

Source

fn write_processing_instruction( &mut self, target: &str, data: &str, ) -> Result<(), Error>

Serialize a processing instruction node, for example <?xml-stylesheet type="text/xsl" href="style.xsl"?>.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§