pub trait OpenXmlSerialize: OpenXmlElementInfo {
    // Required methods
    fn attributes(&self) -> Option<Vec<Attribute<'_>>>;
    fn namespaces(&self) -> Option<Cow<'_, Namespaces>>;
    fn write_inner<W: Write>(&self, writer: W) -> Result<()>;

    // Provided methods
    fn write_outter<W: Write>(&self, writer: W) -> Result<()> { ... }
    fn save_as<P: AsRef<Path>>(&self, path: P) -> Result<(), OoxmlError> { ... }
    fn to_xml_bytes(&self) -> Result<Vec<u8>, OoxmlError> { ... }
    fn to_xml_string(&self) -> Result<String, OoxmlError> { ... }
}
Expand description

Common element trait.

Required Methods§

source

fn attributes(&self) -> Option<Vec<Attribute<'_>>>

Get element attributes, if have.

source

fn namespaces(&self) -> Option<Cow<'_, Namespaces>>

Get element namespaces, if have.

source

fn write_inner<W: Write>(&self, writer: W) -> Result<()>

Serialize to writer

Provided Methods§

source

fn write_outter<W: Write>(&self, writer: W) -> Result<()>

Write outter xml to writer.

Write decl if is root element.

source

fn save_as<P: AsRef<Path>>(&self, path: P) -> Result<(), OoxmlError>

Write the standalone xml to path

source

fn to_xml_bytes(&self) -> Result<Vec<u8>, OoxmlError>

Output the xml to an Vec block.

source

fn to_xml_string(&self) -> Result<String, OoxmlError>

Output the xml to string.

Object Safety§

This trait is not object safe.

Implementors§