pub struct NodeId { /* private fields */ }
Expand description
A node identifier within a particular Arena
.
Implementations§
Source§impl NodeId
impl NodeId
pub const ZERO: NodeId
Sourcepub const fn new(value: usize) -> Self
pub const fn new(value: usize) -> Self
NOTE: In debug mode, it panics on overflow, since having a
pointer that is zero is undefined behaviour (it would basically be
cast to a None
), which is incorrect, so we rather panic on overflow
to prevent that.
To trigger an overflow however, you’d need more that 4 billion DOM nodes - it is more likely that you run out of RAM before you do that. The only thing that could lead to an overflow would be a bug. Therefore, overflow-checking is disabled in release mode.
pub const fn from_usize(value: usize) -> Option<Self>
pub const fn into_usize(val: &Option<Self>) -> usize
pub fn index(&self) -> usize
Source§impl NodeId
impl NodeId
Sourcepub const fn ancestors<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> Ancestors<'a> ⓘ
pub const fn ancestors<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> Ancestors<'a> ⓘ
Return an iterator of references to this node and its ancestors.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub const fn preceding_siblings<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> PrecedingSiblings<'a> ⓘ
pub const fn preceding_siblings<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> PrecedingSiblings<'a> ⓘ
Return an iterator of references to this node and the siblings before it.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub const fn following_siblings<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> FollowingSiblings<'a> ⓘ
pub const fn following_siblings<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> FollowingSiblings<'a> ⓘ
Return an iterator of references to this node and the siblings after it.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub fn children<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> Children<'a> ⓘ
pub fn children<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> Children<'a> ⓘ
Return an iterator of references to this node’s children.
Sourcepub fn reverse_children<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> ReverseChildren<'a> ⓘ
pub fn reverse_children<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> ReverseChildren<'a> ⓘ
Return an iterator of references to this node’s children, in reverse order.
Sourcepub const fn descendants<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> Descendants<'a> ⓘ
pub const fn descendants<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> Descendants<'a> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Parent nodes appear before the descendants.
Call .next().unwrap()
once on the iterator to skip the node itself.
Sourcepub const fn traverse<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> Traverse<'a> ⓘ
pub const fn traverse<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> Traverse<'a> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Sourcepub const fn reverse_traverse<'a>(
self,
node_hierarchy: &'a NodeHierarchyRef<'a>,
) -> ReverseTraverse<'a> ⓘ
pub const fn reverse_traverse<'a>( self, node_hierarchy: &'a NodeHierarchyRef<'a>, ) -> ReverseTraverse<'a> ⓘ
Return an iterator of references to this node and its descendants, in tree order.
Source§impl NodeId
impl NodeId
pub fn get_nearest_matching_parent<'a, F>( self, node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>, predicate: F, ) -> Option<NodeId>
Sourcepub fn az_children_collect<'a>(
self,
node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>,
) -> Vec<NodeId>
pub fn az_children_collect<'a>( self, node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>, ) -> Vec<NodeId>
Return the children of this node (necessary for parallel iteration over children)
Sourcepub fn az_children<'a>(
self,
node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>,
) -> AzChildren<'a> ⓘ
pub fn az_children<'a>( self, node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>, ) -> AzChildren<'a> ⓘ
Return an iterator of references to this node’s children.
Sourcepub fn az_reverse_children<'a>(
self,
node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>,
) -> AzReverseChildren<'a> ⓘ
pub fn az_reverse_children<'a>( self, node_hierarchy: &'a NodeDataContainerRef<'a, NodeHierarchyItem>, ) -> AzReverseChildren<'a> ⓘ
Return an iterator of references to this node’s children.
Trait Implementations§
Source§impl AddAssign<usize> for NodeId
impl AddAssign<usize> for NodeId
Source§fn add_assign(&mut self, other: usize)
fn add_assign(&mut self, other: usize)
+=
operation. Read moreSource§impl<'a, T> Index<NodeId> for NodeDataContainerRef<'a, T>
impl<'a, T> Index<NodeId> for NodeDataContainerRef<'a, T>
Source§impl<'a, T> Index<NodeId> for NodeDataContainerRefMut<'a, T>
impl<'a, T> Index<NodeId> for NodeDataContainerRefMut<'a, T>
Source§impl<'a> Index<NodeId> for NodeHierarchyRef<'a>
impl<'a> Index<NodeId> for NodeHierarchyRef<'a>
Source§impl<'a> Index<NodeId> for NodeHierarchyRefMut<'a>
impl<'a> Index<NodeId> for NodeHierarchyRefMut<'a>
Source§impl<'a, T> IndexMut<NodeId> for NodeDataContainerRefMut<'a, T>
impl<'a, T> IndexMut<NodeId> for NodeDataContainerRefMut<'a, T>
Source§impl<'a> IndexMut<NodeId> for NodeHierarchyRefMut<'a>
impl<'a> IndexMut<NodeId> for NodeHierarchyRefMut<'a>
Source§impl Ord for NodeId
impl Ord for NodeId
Source§impl PartialOrd for NodeId
impl PartialOrd for NodeId
impl Copy for NodeId
impl Eq for NodeId
impl StructuralPartialEq for NodeId
Auto Trait Implementations§
impl Freeze for NodeId
impl RefUnwindSafe for NodeId
impl Send for NodeId
impl Sync for NodeId
impl Unpin for NodeId
impl UnwindSafe for NodeId
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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>
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>
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