#[non_exhaustive]pub struct XmlElement {
pub name: ExpandedName<'static>,
pub attributes: VecDeque<XmlAttribute>,
pub children: XmlSeq<XmlChild>,
pub enforce_prefix: IncludePrefix,
pub preferred_prefix: Option<Prefix<'static>>,
}
Expand description
An XML element.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. }
syntax; cannot be matched against without a wildcard ..
; and struct update syntax will not work.name: ExpandedName<'static>
The name of the element.
attributes: VecDeque<XmlAttribute>
The attributes of the element.
children: XmlSeq<XmlChild>
The children of the element.
enforce_prefix: IncludePrefix
Whether to enforce the prefix of the element.
preferred_prefix: Option<Prefix<'static>>
The preferred prefix of the element.
Implementations§
Source§impl XmlElement
impl XmlElement
Sourcepub fn new<T: Into<ExpandedName<'static>>>(name: T) -> Self
pub fn new<T: Into<ExpandedName<'static>>>(name: T) -> Self
Creates a new XML element.
Sourcepub fn with_attribute<T: Into<XmlAttribute>>(self, attribute: T) -> Self
pub fn with_attribute<T: Into<XmlAttribute>>(self, attribute: T) -> Self
Adds an attribute to the element.
Sourcepub fn with_attributes<U: Into<XmlAttribute>, T: IntoIterator<Item = U>>(
self,
attributes: T,
) -> Self
pub fn with_attributes<U: Into<XmlAttribute>, T: IntoIterator<Item = U>>( self, attributes: T, ) -> Self
Adds multiple attributes to the element.
Sourcepub fn with_child<T: Into<XmlChild>>(self, child: T) -> Self
pub fn with_child<T: Into<XmlChild>>(self, child: T) -> Self
Adds a child to the element.
Sourcepub fn with_children<U: Into<XmlChild>, T: IntoIterator<Item = U>>(
self,
children: T,
) -> Self
pub fn with_children<U: Into<XmlChild>, T: IntoIterator<Item = U>>( self, children: T, ) -> Self
Adds multiple children to the element.
Trait Implementations§
Source§impl Clone for XmlElement
impl Clone for XmlElement
Source§fn clone(&self) -> XmlElement
fn clone(&self) -> XmlElement
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Debug for XmlElement
impl Debug for XmlElement
Source§impl<'de> Deserialize<'de> for XmlElement
impl<'de> Deserialize<'de> for XmlElement
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserializes a value from a deserializer.
Source§fn deserialize_seq<D: Deserializer<'de>>(reader: D) -> Result<Self, D::Error>
fn deserialize_seq<D: Deserializer<'de>>(reader: D) -> Result<Self, D::Error>
Deserializes a value from a deserializer, but tries to do it from a sequence of values.
Source§impl<'de> Deserializer<'de> for &'de XmlElement
impl<'de> Deserializer<'de> for &'de XmlElement
Source§impl From<XmlElement> for XmlChild
impl From<XmlElement> for XmlChild
Source§fn from(value: XmlElement) -> Self
fn from(value: XmlElement) -> Self
Converts to this type from the input type.
Source§impl From<XmlElement> for XmlValue
impl From<XmlElement> for XmlValue
Source§fn from(value: XmlElement) -> Self
fn from(value: XmlElement) -> Self
Converts to this type from the input type.
Source§impl Hash for XmlElement
impl Hash for XmlElement
Source§impl Ord for XmlElement
impl Ord for XmlElement
Source§fn cmp(&self, other: &XmlElement) -> Ordering
fn cmp(&self, other: &XmlElement) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for XmlElement
impl PartialEq for XmlElement
Source§impl PartialOrd for XmlElement
impl PartialOrd for XmlElement
Source§impl Serialize for XmlElement
impl Serialize for XmlElement
Source§impl SerializeAttributes for &mut XmlElement
impl SerializeAttributes for &mut XmlElement
Source§type Error = XmlValueSerializerError
type Error = XmlValueSerializerError
The type of the error that is returned when serialization fails.
Source§fn serialize_attribute<A: SerializeAttribute>(
&mut self,
a: &A,
) -> Result<Self::Ok, Self::Error>
fn serialize_attribute<A: SerializeAttribute>( &mut self, a: &A, ) -> Result<Self::Ok, Self::Error>
Serializes an attribute.
Source§impl<'s> SerializeElement for &'s mut XmlElement
impl<'s> SerializeElement for &'s mut XmlElement
Source§type Error = XmlValueSerializerError
type Error = XmlValueSerializerError
The type of the error that is returned when serialization fails.
Source§type ChildrenSerializeSeq = &'s mut XmlSeq<XmlChild>
type ChildrenSerializeSeq = &'s mut XmlSeq<XmlChild>
The type of the serializer that is returned when serializing the children of this element.
Source§type SerializeElementAttributes = &'s mut XmlElement
type SerializeElementAttributes = &'s mut XmlElement
The type of the serializer that is returned when serializing the attributes of this element.
Source§fn include_prefix(
&mut self,
should_enforce: IncludePrefix,
) -> Result<Self::Ok, Self::Error>
fn include_prefix( &mut self, should_enforce: IncludePrefix, ) -> Result<Self::Ok, Self::Error>
Always serialize this element with the given prefix.
Source§fn preferred_prefix(
&mut self,
preferred_prefix: Option<Prefix<'_>>,
) -> Result<Self::Ok, Self::Error>
fn preferred_prefix( &mut self, preferred_prefix: Option<Prefix<'_>>, ) -> Result<Self::Ok, Self::Error>
Set the preferred prefix for this element.
Source§fn serialize_children(self) -> Result<Self::ChildrenSerializeSeq, Self::Error>
fn serialize_children(self) -> Result<Self::ChildrenSerializeSeq, Self::Error>
Serialize the children of this element.
Source§fn end(self) -> Result<Self::Ok, Self::Error>
fn end(self) -> Result<Self::Ok, Self::Error>
End the serialization of this element with no children.
Source§fn serialize_attributes(
self,
) -> Result<Self::SerializeElementAttributes, Self::Error>
fn serialize_attributes( self, ) -> Result<Self::SerializeElementAttributes, Self::Error>
Serialize the attributes of this element.
Source§impl<'s> SerializeElementAttributes for &'s mut XmlElement
impl<'s> SerializeElementAttributes for &'s mut XmlElement
Source§type ChildrenSerializeSeq = &'s mut XmlSeq<XmlChild>
type ChildrenSerializeSeq = &'s mut XmlSeq<XmlChild>
The type of the value that is returned when serialization is successful.
Source§fn serialize_children(self) -> Result<Self::ChildrenSerializeSeq, Self::Error>
fn serialize_children(self) -> Result<Self::ChildrenSerializeSeq, Self::Error>
Serialize the children of this element.
impl Eq for XmlElement
impl StructuralPartialEq for XmlElement
Auto Trait Implementations§
impl Freeze for XmlElement
impl RefUnwindSafe for XmlElement
impl Send for XmlElement
impl Sync for XmlElement
impl Unpin for XmlElement
impl UnwindSafe for XmlElement
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more