pub enum Item<'x> {
XmlDeclaration(XmlVersion),
ElementHeadStart(Namespace, Cow<'x, NcNameStr>),
Attribute(Namespace, Cow<'x, NcNameStr>, Cow<'x, str>),
ElementHeadEnd,
Text(Cow<'x, str>),
ElementFoot,
}
Expand description
§Serialisable piece of XML
This item represents a piece of an XML document which can be serialised
into bytes by converting it to an rxml::Item
and then feeding it to a
rxml::Encoder
.
Unlike rxml::Item
, the contents of this item may either be owned or
borrowed, individually. This enables the use in an crate::AsXml
trait
even if data needs to be generated during serialisation.
Variants§
XmlDeclaration(XmlVersion)
XML declaration
ElementHeadStart(Namespace, Cow<'x, NcNameStr>)
Start of an element header
Attribute(Namespace, Cow<'x, NcNameStr>, Cow<'x, str>)
An attribute key/value pair
Tuple Fields
ElementHeadEnd
End of an element header
Text(Cow<'x, str>)
A piece of text (in element content, not attributes)
ElementFoot
Footer of an element
This can be used either in places where Text
could be used to
close the most recently opened unclosed element, or it can be used
instead of ElementHeadEnd
to close the element using />
, without
any child content.
Implementations§
Source§impl Item<'_>
impl Item<'_>
Sourcepub fn into_owned(self) -> Item<'static>
pub fn into_owned(self) -> Item<'static>
Exchange all borrowed pieces inside this item for owned items, cloning them if necessary.
Sourcepub fn as_rxml_item(&self) -> Item<'_>
pub fn as_rxml_item(&self) -> Item<'_>
Return an rxml::Item
, which borrows data from this item.