pub struct WalkMutBorrowed<'r, TP: TreeProperties + 'r, D = (), A = ()> { /* private fields */ }Expand description
Walk borrowed mutable tree up and down
Some algorithms need to remember how they reached the current node via WalkedDirection as D.
When walking manually it might be useful to be able to store additional data via A.
Implementations§
source§impl<'r, TP, D, A> WalkMutBorrowed<'r, TP, D, A>where
TP: TreeProperties,
impl<'r, TP, D, A> WalkMutBorrowed<'r, TP, D, A>where
TP: TreeProperties,
sourcepub fn current_mut(
&mut self,
) -> NodeOrTree<Option<&mut Node<TP>>, &mut Node<TP>>
pub fn current_mut( &mut self, ) -> NodeOrTree<Option<&mut Node<TP>>, &mut Node<TP>>
Current mutable node or tree
If you need the result to outlive the destruction of the WalkMutBorrowed value, see into_current_mut.
sourcepub fn into_current_mut(
self,
) -> NodeOrTree<Option<&'r mut Node<TP>>, &'r mut Node<TP>>
pub fn into_current_mut( self, ) -> NodeOrTree<Option<&'r mut Node<TP>>, &'r mut Node<TP>>
Extract mutable node or tree
Also see current_mut
source§impl<'r, TP, D, A> WalkMutBorrowed<'r, TP, D, A>
impl<'r, TP, D, A> WalkMutBorrowed<'r, TP, D, A>
sourcepub fn down_root_with(&mut self, add: A) -> bool
pub fn down_root_with(&mut self, add: A) -> bool
Walk down from tree to root node (if at tree and not empty)
sourcepub fn down_left_with(&mut self, add: A) -> bool
pub fn down_left_with(&mut self, add: A) -> bool
Walk down to left node if present and not currently at tree
sourcepub fn down_right_with(&mut self, add: A) -> bool
pub fn down_right_with(&mut self, add: A) -> bool
Walk down to right node if present and not currently at tree
source§impl<'r, TP, D> WalkMutBorrowed<'r, TP, D, ()>
impl<'r, TP, D> WalkMutBorrowed<'r, TP, D, ()>
sourcepub fn down_root(&mut self) -> bool
pub fn down_root(&mut self) -> bool
Walk down from tree to root node (if at tree and not empty)
sourcepub fn down_left(&mut self) -> bool
pub fn down_left(&mut self) -> bool
Walk down to left node if present and not currently at tree
sourcepub fn down_right(&mut self) -> bool
pub fn down_right(&mut self) -> bool
Walk down to right node if present and not currently at tree
source§impl<'r, TP, D> WalkMutBorrowed<'r, TP, D>
impl<'r, TP, D> WalkMutBorrowed<'r, TP, D>
sourcepub fn path(&mut self, key: TP::Key) -> WalkMutBorrowedPath<'r, '_, TP, D>
pub fn path(&mut self, key: TP::Key) -> WalkMutBorrowedPath<'r, '_, TP, D>
Start iterator to walk to deepest node that is a prefix of the target key
While consuming the iterator the stack is updated with the position of the returned nodes.
When self was in a mismatching subtree (i.e. not a prefix of the target key) before
the iterator won’t find anything.
sourcepub fn goto_insert(&mut self, key: &TP::Key) -> Option<InsertPosition>
pub fn goto_insert(&mut self, key: &TP::Key) -> Option<InsertPosition>
Walk to node where we’d have to insert key at
Returns None if tree is empty.
source§impl<'r, TP> WalkMutBorrowed<'r, TP, WalkedDirection, ()>where
TP: TreeProperties + 'r,
impl<'r, TP> WalkMutBorrowed<'r, TP, WalkedDirection, ()>where
TP: TreeProperties + 'r,
sourcepub fn into_iter_pre_order(self) -> IterMutBorrowedPreOrder<'r, TP> ⓘ
pub fn into_iter_pre_order(self) -> IterMutBorrowedPreOrder<'r, TP> ⓘ
Convert into iterator traversing depth-first pre-order
sourcepub fn next_pre_order(&mut self) -> Option<&mut Node<TP>>
pub fn next_pre_order(&mut self) -> Option<&mut Node<TP>>
Tree traversal: depth-first pre-order
sourcepub fn into_iter_in_order(self) -> IterMutBorrowedInOrder<'r, TP> ⓘ
pub fn into_iter_in_order(self) -> IterMutBorrowedInOrder<'r, TP> ⓘ
Convert into iterator traversing depth-first in-order
sourcepub fn next_in_order(&mut self) -> Option<&mut Node<TP>>
pub fn next_in_order(&mut self) -> Option<&mut Node<TP>>
Tree traversal: depth-first in-order
sourcepub fn into_iter_post_order(self) -> IterMutBorrowedPostOrder<'r, TP> ⓘ
pub fn into_iter_post_order(self) -> IterMutBorrowedPostOrder<'r, TP> ⓘ
Convert into iterator traversing depth-first post-order
sourcepub fn next_post_order(&mut self) -> Option<&mut Node<TP>>
pub fn next_post_order(&mut self) -> Option<&mut Node<TP>>
Tree traversal: depth-first post-order
sourcepub fn into_iter_leafs(self) -> IterMutBorrowedLeaf<'r, TP> ⓘ
pub fn into_iter_leafs(self) -> IterMutBorrowedLeaf<'r, TP> ⓘ
Convert into iterator over all leafs
sourcepub fn into_iter_full_leafs(self) -> IterMutBorrowedLeafFull<'r, TP> ⓘ
pub fn into_iter_full_leafs(self) -> IterMutBorrowedLeafFull<'r, TP> ⓘ
Convert into iterator over all leafs and uncovered parts