pub trait AsOptionalXmlText {
    // Required method
    fn as_optional_xml_text(&self) -> Result<Option<Cow<'_, str>>, Error>;
}Expand description
Specialized variant of AsXmlText.
Normally, it should not be necessary to implement this trait as it is
automatically implemented for all types implementing AsXmlText.
However, if your type can only be serialised as an XML attribute (for
example because an absent value has a particular meaning), it is correct
to implement AsOptionalXmlText instead of AsXmlText.
 If your type can be serialised as both (text and attribute) but needs
special handling in attributes, implement AsXmlText but provide a
custom implementation of AsXmlText::as_optional_xml_text.
Important: See the text module’s documentation
for notes regarding implementations for types from third-party crates.