Trait markup5ever::serialize::Serializer

source ·
pub trait Serializer {
    // Required methods
    fn start_elem<'a, AttrIter>(
        &mut self,
        name: QualName,
        attrs: AttrIter,
    ) -> Result<()>
       where AttrIter: Iterator<Item = AttrRef<'a>>;
    fn end_elem(&mut self, name: QualName) -> Result<()>;
    fn write_text(&mut self, text: &str) -> Result<()>;
    fn write_comment(&mut self, text: &str) -> Result<()>;
    fn write_doctype(&mut self, name: &str) -> Result<()>;
    fn write_processing_instruction(
        &mut self,
        target: &str,
        data: &str,
    ) -> Result<()>;
}
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<()>
where AttrIter: Iterator<Item = AttrRef<'a>>,

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

source

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

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

source

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

Serialize a plain text node.

source

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

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

source

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

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

source

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

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

Object Safety§

This trait is not object safe.

Implementors§