pub enum XmlContent {
Element(XmlElement),
Text(XmlText),
Comment(XmlComment),
}Expand description
Represents the content of an XML node.
Variants§
Element(XmlElement)
An XML element with a qualified name and attributes.
Text(XmlText)
XML text content.
Comment(XmlComment)
XML comment.
Implementations§
Source§impl XmlContent
impl XmlContent
Sourcepub fn info_size(&self) -> i32
pub fn info_size(&self) -> i32
Returns the information size of this content.
This metric is used for similarity calculations and copy detection.
Sourcepub fn content_equals(&self, other: &XmlContent) -> bool
pub fn content_equals(&self, other: &XmlContent) -> bool
Tests content equality using MD5 hash comparison.
Sourcepub fn content_hash(&self) -> i32
pub fn content_hash(&self) -> i32
Returns a 32-bit hash code for this content.
This is used for fast equality pre-checks and child list distance calculations.
Sourcepub fn is_element(&self) -> bool
pub fn is_element(&self) -> bool
Returns true if this is an element node.
Sourcepub fn is_comment(&self) -> bool
pub fn is_comment(&self) -> bool
Returns true if this is a comment node.
Sourcepub fn as_element(&self) -> Option<&XmlElement>
pub fn as_element(&self) -> Option<&XmlElement>
Returns a reference to the element, if this is an element node.
Sourcepub fn as_element_mut(&mut self) -> Option<&mut XmlElement>
pub fn as_element_mut(&mut self) -> Option<&mut XmlElement>
Returns a mutable reference to the element, if this is an element node.
Sourcepub fn as_text(&self) -> Option<&XmlText>
pub fn as_text(&self) -> Option<&XmlText>
Returns a reference to the text, if this is a text node.
Sourcepub fn as_text_mut(&mut self) -> Option<&mut XmlText>
pub fn as_text_mut(&mut self) -> Option<&mut XmlText>
Returns a mutable reference to the text, if this is a text node.
Trait Implementations§
Source§impl Clone for XmlContent
impl Clone for XmlContent
Source§fn clone(&self) -> XmlContent
fn clone(&self) -> XmlContent
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 moreAuto Trait Implementations§
impl Freeze for XmlContent
impl RefUnwindSafe for XmlContent
impl Send for XmlContent
impl Sync for XmlContent
impl Unpin for XmlContent
impl UnwindSafe for XmlContent
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