Struct matrix_sdk::ruma::html::NodeRef
source · #[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<Tendril<UTF8>>>
pub fn as_text(&self) -> Option<&RefCell<Tendril<UTF8>>>
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
)source§impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
impl<T, W> HasTypeWitness<W> for Twhere
W: MakeTypeWitness<Arg = T>,
T: ?Sized,
source§impl<T> Identity for Twhere
T: ?Sized,
impl<T> Identity for Twhere
T: ?Sized,
source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more