pub enum NodeKind {
Element {
tag_id: TagId,
name: String,
attributes: HashMap<String, String>,
},
Text {
content: String,
},
Comment {
content: String,
},
}Expand description
Types of nodes in the DOM tree.
Variants§
Implementations§
Source§impl NodeKind
impl NodeKind
Sourcepub fn as_element_name(&self) -> Option<&str>
👎Deprecated since 0.2.0: use tag_name() instead
pub fn as_element_name(&self) -> Option<&str>
tag_name() insteadAlias for tag_name for backwards compatibility.
Sourcepub fn attributes(&self) -> Option<&HashMap<String, String>>
pub fn attributes(&self) -> Option<&HashMap<String, String>>
Returns the attributes if this is an element node.
Sourcepub fn is_tag(&self, tag_id: TagId) -> bool
pub fn is_tag(&self, tag_id: TagId) -> bool
Returns true if this element has the given tag ID (fast path).
Sourcepub fn as_comment(&self) -> Option<&str>
pub fn as_comment(&self) -> Option<&str>
Returns the comment content if this is a comment node.
Sourcepub const fn is_element(&self) -> bool
pub const fn is_element(&self) -> bool
Returns true if this is an element node.
Sourcepub const fn is_comment(&self) -> bool
pub const fn is_comment(&self) -> bool
Returns true if this is a comment node.
Trait Implementations§
impl Eq for NodeKind
impl StructuralPartialEq for NodeKind
Auto Trait Implementations§
impl Freeze for NodeKind
impl RefUnwindSafe for NodeKind
impl Send for NodeKind
impl Sync for NodeKind
impl Unpin for NodeKind
impl UnwindSafe for NodeKind
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