pub trait Serializer {
// Required methods
fn serialize_attribute(
&mut self,
key: &str,
value: Cow<'_, str>,
) -> Result<()>;
fn serialize_text(&mut self, text: Cow<'_, str>) -> Result<()>;
fn serialize_element<E: Element>(&mut self, element: &E) -> Result<()>;
}
Expand description
Interface to serialize an element.
An element needs to serialize attributes first, then inner text and elements.
Required Methods§
Sourcefn serialize_attribute(&mut self, key: &str, value: Cow<'_, str>) -> Result<()>
fn serialize_attribute(&mut self, key: &str, value: Cow<'_, str>) -> Result<()>
Add an attribute to the serialized element
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.