#[non_exhaustive]pub struct NodeRef(/* private fields */);
Expand description
A reference to an HTML node.
Implementations§
source§impl NodeRef
impl NodeRef
sourcepub fn as_element(&self) -> Option<&ElementData>
pub fn as_element(&self) -> Option<&ElementData>
Returns the data of this Node
if it is an Element (aka an HTML tag).
sourcepub fn as_text(&self) -> Option<&RefCell<StrTendril>>
pub fn as_text(&self) -> Option<&RefCell<StrTendril>>
Returns the text content of this Node
, if it is a NodeData::Text
.
sourcepub fn parent(&self) -> Option<NodeRef>
pub fn parent(&self) -> Option<NodeRef>
The parent node of this node.
Returns None
if the parent is the root node.
sourcepub fn next_sibling(&self) -> Option<NodeRef>
pub fn next_sibling(&self) -> Option<NodeRef>
The next sibling node of this node.
Returns None
if this is the last of its siblings.
sourcepub fn prev_sibling(&self) -> Option<NodeRef>
pub fn prev_sibling(&self) -> Option<NodeRef>
The previous sibling node of this node.
Returns None
if this is the first of its siblings.
sourcepub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Whether this node has children.
sourcepub fn first_child(&self) -> Option<NodeRef>
pub fn first_child(&self) -> Option<NodeRef>
The first child node of this node.
Returns None
if this node has no children.
sourcepub fn last_child(&self) -> Option<NodeRef>
pub fn last_child(&self) -> Option<NodeRef>
The last child node of this node.
Returns None
if this node has no children.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for NodeRef
impl !RefUnwindSafe for NodeRef
impl !Send for NodeRef
impl !Sync for NodeRef
impl Unpin for NodeRef
impl !UnwindSafe for NodeRef
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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§default unsafe fn clone_to_uninit(&self, dst: *mut T)
default unsafe fn clone_to_uninit(&self, dst: *mut T)
🔬This is a nightly-only experimental API. (
clone_to_uninit
)