pub struct Node { /* private fields */ }Expand description
A single HTML node.
Implementations§
Source§impl Node
impl Node
Sourcepub fn parent(&self) -> Option<Node>
pub fn parent(&self) -> Option<Node>
Get the node’s parent node, returning None if there isn’t one.
Sourcepub fn child_nodes(&self) -> Vec<Node>
pub fn child_nodes(&self) -> Vec<Node>
Get the node’s child nodes.
Sourcepub fn next(&self) -> Option<Node>
pub fn next(&self) -> Option<Node>
Get the next sibling of the node, returning None if there isn’t one.
Sourcepub fn prev(&self) -> Option<Node>
pub fn prev(&self) -> Option<Node>
Get the previous sibling of the node, returning None if there isn’t one.
Sourcepub fn outer_html(&self) -> Option<String>
pub fn outer_html(&self) -> Option<String>
Get the node’s outer HTML.
Sourcepub fn has_attr<T: AsRef<str>>(&self, attr_name: T) -> bool
pub fn has_attr<T: AsRef<str>>(&self, attr_name: T) -> bool
Test if this node has an attribute. Case insensitive.
Sourcepub fn set_attr<K: AsRef<str>, V: AsRef<str>>(
&mut self,
key: K,
value: V,
) -> Result<(), HtmlError>
pub fn set_attr<K: AsRef<str>, V: AsRef<str>>( &mut self, key: K, value: V, ) -> Result<(), HtmlError>
Set an attribute value on this node.
If this node already has an attribute with the key, its value is updated; otherwise, a new attribute is added.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Node
impl RefUnwindSafe for Node
impl Send for Node
impl Sync for Node
impl Unpin for Node
impl UnsafeUnpin for Node
impl UnwindSafe for Node
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