Skip to main content

ToXml

Trait ToXml 

Source
pub trait ToXml {
    // Provided methods
    fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a> { ... }
    fn write_children<W: Write>(
        &self,
        _writer: &mut Writer<W>,
    ) -> Result<(), SerializeError> { ... }
    fn is_empty_element(&self) -> bool { ... }
    fn write_element<W: Write>(
        &self,
        tag: &str,
        writer: &mut Writer<W>,
    ) -> Result<(), SerializeError> { ... }
}
Expand description

Trait for types that can be serialized to XML elements.

Implemented by generated OOXML types to enable roundtrip serialization.

Provided Methods§

Source

fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>

Write attributes onto the start tag and return it.

Source

fn write_children<W: Write>( &self, _writer: &mut Writer<W>, ) -> Result<(), SerializeError>

Write child elements and text content inside the element.

Source

fn is_empty_element(&self) -> bool

Whether this element has no children (self-closing).

Source

fn write_element<W: Write>( &self, tag: &str, writer: &mut Writer<W>, ) -> Result<(), SerializeError>

Write a complete element: <tag attrs>children</tag> or <tag attrs/>.

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.

Implementations on Foreign Types§

Source§

impl<T: ToXml> ToXml for Box<T>

Source§

fn write_attrs<'a>(&self, start: BytesStart<'a>) -> BytesStart<'a>

Source§

fn write_children<W: Write>( &self, writer: &mut Writer<W>, ) -> Result<(), SerializeError>

Source§

fn is_empty_element(&self) -> bool

Source§

fn write_element<W: Write>( &self, tag: &str, writer: &mut Writer<W>, ) -> Result<(), SerializeError>

Implementors§