Struct TreeMutIter

Source
pub struct TreeMutIter<'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., DepthFirst or BreadthFirst).

Implementations§

Source§

impl<'a, N, T> TreeMutIter<'a, N, T>

Source

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> TreeMutIter<'a, N, BreadthFirst>

Source

pub fn next<'b>(&'b mut self) -> Option<MutRefBFSGuard<'a, 'b, 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> TreeMutIter<'a, N, DepthFirst>

Source

pub fn next<'b>(&'b mut self) -> Option<MutRefDFSGuard<'a, 'b, 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§

Source§

impl<'a, N: Debug, T: Debug> Debug for TreeMutIter<'a, N, T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

§

impl<'a, N, T> Freeze for TreeMutIter<'a, N, T>

§

impl<'a, N, T> RefUnwindSafe for TreeMutIter<'a, N, T>

§

impl<'a, N, T> Send for TreeMutIter<'a, N, T>
where T: Send, N: Send,

§

impl<'a, N, T> Sync for TreeMutIter<'a, N, T>
where T: Sync, N: Sync,

§

impl<'a, N, T> Unpin for TreeMutIter<'a, N, T>
where T: Unpin,

§

impl<'a, N, T> !UnwindSafe for TreeMutIter<'a, N, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.