Enum im_pathtree::Node
source · pub enum Node<T>where
T: PathTreeTypes,{
Inner(InnerNode<T>),
Leaf(LeafNode<<T as PathTreeTypes>::LeafValue>),
}Variants§
Implementations§
source§impl<T> Node<T>where
T: PathTreeTypes,
impl<T> Node<T>where
T: PathTreeTypes,
pub const fn inner_value(&self) -> Option<&T::InnerValue>
pub const fn leaf_value(&self) -> Option<&T::LeafValue>
source§impl<T> Node<T>where
T: PathTreeTypes,
impl<T> Node<T>where
T: PathTreeTypes,
sourcepub fn number_of_children(&self) -> usize
pub fn number_of_children(&self) -> usize
Returns the number of children
Only includes direct children, not grandchildren or other descendants.
sourcepub fn children(&self) -> impl ExactSizeIterator<Item = HalfEdgeRef<'_, T>> + '_
pub fn children(&self) -> impl ExactSizeIterator<Item = HalfEdgeRef<'_, T>> + '_
Returns an iterator over all children of this node
Only includes direct children, not grandchildren or other descendants.
sourcepub fn descendants<'a>(
&'a self,
tree: &'a PathTree<T>,
) -> DepthFirstDescendantsIter<'a, T> ⓘ
pub fn descendants<'a>( &'a self, tree: &'a PathTree<T>, ) -> DepthFirstDescendantsIter<'a, T> ⓘ
Returns an iterator over all descendants of this node
Recursively traverse the subtree.
The ordering of nodes is undefined and an implementation detail. Only parent nodes are guaranteed to be visited before their children.
pub fn count_descendants<'a>(&'a self, tree: &'a PathTree<T>) -> usize
Trait Implementations§
source§impl<T> From<LeafNode<<T as PathTreeTypes>::LeafValue>> for Node<T>where
T: PathTreeTypes,
impl<T> From<LeafNode<<T as PathTreeTypes>::LeafValue>> for Node<T>where
T: PathTreeTypes,
Auto Trait Implementations§
impl<T> Freeze for Node<T>
impl<T> RefUnwindSafe for Node<T>where
<T as PathTreeTypes>::InnerValue: RefUnwindSafe,
<T as PathTreeTypes>::LeafValue: RefUnwindSafe,
<T as PathTreeTypes>::PathSegment: RefUnwindSafe,
<T as PathTreeTypes>::NodeId: RefUnwindSafe,
impl<T> Send for Node<T>where
<T as PathTreeTypes>::InnerValue: Send,
<T as PathTreeTypes>::LeafValue: Send,
<T as PathTreeTypes>::PathSegment: Sync + Send,
<T as PathTreeTypes>::NodeId: Sync + Send,
impl<T> Sync for Node<T>where
<T as PathTreeTypes>::InnerValue: Sync,
<T as PathTreeTypes>::LeafValue: Sync,
<T as PathTreeTypes>::PathSegment: Sync + Send,
<T as PathTreeTypes>::NodeId: Sync + Send,
impl<T> Unpin for Node<T>where
<T as PathTreeTypes>::InnerValue: Unpin,
<T as PathTreeTypes>::LeafValue: Unpin,
<T as PathTreeTypes>::PathSegment: Unpin,
<T as PathTreeTypes>::NodeId: Unpin,
impl<T> UnwindSafe for Node<T>where
<T as PathTreeTypes>::InnerValue: UnwindSafe,
<T as PathTreeTypes>::LeafValue: UnwindSafe,
<T as PathTreeTypes>::PathSegment: RefUnwindSafe + UnwindSafe,
<T as PathTreeTypes>::NodeId: RefUnwindSafe + UnwindSafe,
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> 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