Struct matrix_sdk::ruma::html::NodeRef
#[non_exhaustive]pub struct NodeRef<'a> { /* private fields */ }
Expand description
A reference to an HTML node.
Implementations§
§impl<'a> NodeRef<'a>
impl<'a> NodeRef<'a>
pub fn as_element(&self) -> Option<&'a ElementData>
pub fn as_element(&self) -> Option<&'a ElementData>
Returns the data of this node if it is a NodeData::Element
.
pub fn as_text(&self) -> Option<&'a Tendril<UTF8>>
pub fn as_text(&self) -> Option<&'a Tendril<UTF8>>
Returns the text content of this node, if it is a NodeData::Text
.
pub fn parent(&self) -> Option<NodeRef<'a>>
pub fn parent(&self) -> Option<NodeRef<'a>>
The parent node of this node.
Returns None
if the parent is the root node.
pub fn next_sibling(&self) -> Option<NodeRef<'a>>
pub fn next_sibling(&self) -> Option<NodeRef<'a>>
The next sibling node of this node.
Returns None
if this is the last of its siblings.
pub fn prev_sibling(&self) -> Option<NodeRef<'a>>
pub fn prev_sibling(&self) -> Option<NodeRef<'a>>
The previous sibling node of this node.
Returns None
if this is the first of its siblings.
pub fn has_children(&self) -> bool
pub fn has_children(&self) -> bool
Whether this node has children.
pub fn first_child(&self) -> Option<NodeRef<'a>>
pub fn first_child(&self) -> Option<NodeRef<'a>>
The first child node of this node.
Returns None
if this node has no children.
pub fn last_child(&self) -> Option<NodeRef<'a>>
pub fn last_child(&self) -> Option<NodeRef<'a>>
The last child node of this node.
Returns None
if this node has no children.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for NodeRef<'a>
impl<'a> !RefUnwindSafe for NodeRef<'a>
impl<'a> !Send for NodeRef<'a>
impl<'a> !Sync for NodeRef<'a>
impl<'a> Unpin for NodeRef<'a>
impl<'a> !UnwindSafe for NodeRef<'a>
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> CloneToUninit for Twhere
T: Copy,
impl<T> CloneToUninit for Twhere
T: Copy,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
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