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§
Sourcefn start_elem<'a, AttrIter>(
&mut self,
name: QualName,
attrs: AttrIter,
) -> Result<()>
fn start_elem<'a, AttrIter>( &mut self, name: QualName, attrs: AttrIter, ) -> Result<()>
Serialize the start of an element, for example <div class="test">
.
Sourcefn end_elem(&mut self, name: QualName) -> Result<()>
fn end_elem(&mut self, name: QualName) -> Result<()>
Serialize the end of an element, for example </div>
.
Sourcefn write_text(&mut self, text: &str) -> Result<()>
fn write_text(&mut self, text: &str) -> Result<()>
Serialize a plain text node.
Sourcefn write_comment(&mut self, text: &str) -> Result<()>
fn write_comment(&mut self, text: &str) -> Result<()>
Serialize a comment node, for example <!-- comment -->
.
Sourcefn write_doctype(&mut self, name: &str) -> Result<()>
fn write_doctype(&mut self, name: &str) -> Result<()>
Serialize a doctype node, for example <!doctype html>
.
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.