pub struct TreeIterMut<'a, N, T> { /* private fields */ }Expand description
A mutable iterator over tree nodes in a specified traversal order.
This struct provides the implementation for traversing a tree structure
with mutable access to nodes implementing the TreeNodeMut trait.
§Type Parameters
'a- The lifetime of the tree nodes being traversed.N- The type of tree node.T- The traversal order strategy (e.g.,DepthFirstorBreadthFirst).
Implementations§
Source§impl<'a, N, T> TreeIterMut<'a, N, T>
impl<'a, N, T> TreeIterMut<'a, N, T>
Sourcepub fn new(roots: impl IntoIterator<Item = &'a mut N>) -> Self
pub fn new(roots: impl IntoIterator<Item = &'a mut N>) -> Self
Creates a new mutable tree iterator from a collection of root nodes.
§Parameters
roots- An iterator yielding mutable references to the root nodes to start traversal from.
Source§impl<'a, N: TreeNodeMut> TreeIterMut<'a, N, BreadthFirst>
impl<'a, N: TreeNodeMut> TreeIterMut<'a, N, BreadthFirst>
Sourcepub fn next(&mut self) -> Option<BFSRefMutGuard<'a, '_, N>>
pub fn next(&mut self) -> Option<BFSRefMutGuard<'a, '_, N>>
Returns the next node in breadth-first order.
This method returns a guard that implements DerefMut to provide
mutable access to the node. When the guard is dropped, the node’s children
are added to the traversal queue in breadth-first order.
Source§impl<'a, N: TreeNodeMut> TreeIterMut<'a, N, DepthFirst>
impl<'a, N: TreeNodeMut> TreeIterMut<'a, N, DepthFirst>
Sourcepub fn next(&mut self) -> Option<DFSRefMutGuard<'a, '_, N>>
pub fn next(&mut self) -> Option<DFSRefMutGuard<'a, '_, N>>
Returns the next node in depth-first order.
This method returns a guard that implements DerefMut to provide
mutable access to the node. When the guard is dropped, the node’s children
are added to the traversal queue in depth-first order.
Trait Implementations§
Auto Trait Implementations§
impl<'a, N, T> Freeze for TreeIterMut<'a, N, T>
impl<'a, N, T> RefUnwindSafe for TreeIterMut<'a, N, T>where
T: RefUnwindSafe,
N: RefUnwindSafe,
impl<'a, N, T> Send for TreeIterMut<'a, N, T>
impl<'a, N, T> Sync for TreeIterMut<'a, N, T>
impl<'a, N, T> Unpin for TreeIterMut<'a, N, T>where
T: Unpin,
impl<'a, N, T> !UnwindSafe for TreeIterMut<'a, N, T>
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