pub struct AANode<T>(_);
Implementations
sourceimpl<T: Ord> AANode<T>
impl<T: Ord> AANode<T>
sourcepub fn insert(&mut self, content: T) -> bool
pub fn insert(&mut self, content: T) -> bool
Insert a new node with content
into the tree. If a node with this value already exist,
nothing will be inserted, and false
will be returned.
sourcepub fn insert_or_replace(&mut self, content: T) -> Option<T>
pub fn insert_or_replace(&mut self, content: T) -> Option<T>
Insert a new node with content
into the tree. If a node with this value already exists,
it will be replaced and the old content returned.
sourceimpl<T> AANode<T>
impl<T> AANode<T>
sourcepub fn traverse<'a, F, R>(&'a self, callback: F) -> Option<R> where
F: Fn(&'a T, Option<TraverseStep<R>>) -> TraverseStep<R> + Copy,
pub fn traverse<'a, F, R>(&'a self, callback: F) -> Option<R> where
F: Fn(&'a T, Option<TraverseStep<R>>) -> TraverseStep<R> + Copy,
Traverse the tree looking for a specific value. The callback
is called as follows:
- While going down, with
(content, None)
as the input. The callback may return eitherLeft
orRight
to continue the traversal, orValue
to stop the traversal, for example because a value was found. - While going back up, with
(content, Some(res))
, whereres
is the result from the fully traversed subgraph. The callback must produce aValue
result, a traversal (returningLeft
orRight
) is a logic error and will be ignored.
sourceimpl<T> AANode<T>
impl<T> AANode<T>
sourcepub fn has_left_child(&self) -> bool
pub fn has_left_child(&self) -> bool
Return true if this node has a left child.
sourcepub fn has_right_child(&self) -> bool
pub fn has_right_child(&self) -> bool
Return true if this node has a right child.
Trait Implementations
impl<T> StructuralPartialEq for AANode<T>
Auto Trait Implementations
impl<T> RefUnwindSafe for AANode<T> where
T: RefUnwindSafe,
impl<T> Send for AANode<T> where
T: Send,
impl<T> Sync for AANode<T> where
T: Sync,
impl<T> Unpin for AANode<T>
impl<T> UnwindSafe for AANode<T> where
T: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more