Trait ooxml::packaging::element::OpenXmlSerialize
source · 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§
sourcefn attributes(&self) -> Option<Vec<Attribute<'_>>>
fn attributes(&self) -> Option<Vec<Attribute<'_>>>
Get element attributes, if have.
sourcefn namespaces(&self) -> Option<Cow<'_, Namespaces>>
fn namespaces(&self) -> Option<Cow<'_, Namespaces>>
Get element namespaces, if have.
sourcefn write_inner<W: Write>(&self, writer: W) -> Result<()>
fn write_inner<W: Write>(&self, writer: W) -> Result<()>
Serialize to writer
Provided Methods§
sourcefn write_outter<W: Write>(&self, writer: W) -> Result<()>
fn write_outter<W: Write>(&self, writer: W) -> Result<()>
Write outter xml to writer.
Write decl if is root element.
sourcefn save_as<P: AsRef<Path>>(&self, path: P) -> Result<(), OoxmlError>
fn save_as<P: AsRef<Path>>(&self, path: P) -> Result<(), OoxmlError>
Write the standalone xml to path
sourcefn to_xml_bytes(&self) -> Result<Vec<u8>, OoxmlError>
fn to_xml_bytes(&self) -> Result<Vec<u8>, OoxmlError>
Output the xml to an Vec
sourcefn to_xml_string(&self) -> Result<String, OoxmlError>
fn to_xml_string(&self) -> Result<String, OoxmlError>
Output the xml to string.
Object Safety§
This trait is not object safe.