pub struct Tree<V> { /* private fields */ }Implementations§
Source§impl<V> Tree<V>
impl<V> Tree<V>
pub fn new(root: V) -> Self
pub fn clear(&mut self)
pub fn is_leaf(&self, index: NodeIndex) -> bool
pub fn is_non_leaf(&self, index: NodeIndex) -> bool
pub fn parent(&self, index: NodeIndex) -> Option<NodeIndex>
pub fn get(&self, index: NodeIndex) -> Option<&V>
pub fn get_mut(&mut self, index: NodeIndex) -> Option<&mut V>
Sourcepub fn traverse_from<F, R>(&self, from: NodeIndex, f: F) -> Option<R>
pub fn traverse_from<F, R>(&self, from: NodeIndex, f: F) -> Option<R>
Traverses sub-tree starting with the from node in a DFS way.
§Panics
Panics if the given node index is out of bounds.
pub fn next_index(&self) -> NodeIndex
Trait Implementations§
Auto Trait Implementations§
impl<V> Freeze for Tree<V>
impl<V> RefUnwindSafe for Tree<V>where
V: RefUnwindSafe,
impl<V> Send for Tree<V>where
V: Send,
impl<V> Sync for Tree<V>where
V: Sync,
impl<V> Unpin for Tree<V>where
V: Unpin,
impl<V> UnsafeUnpin for Tree<V>
impl<V> UnwindSafe for Tree<V>where
V: 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> 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