pub struct LevelIter<T> { /* private fields */ }
Expand description
A wrapper iterator that will additionally return the depth of each element.
Implementations
Trait Implementations
sourceimpl<T: FixedDepthVisitor> FixedDepthVisitor for LevelIter<T>
impl<T: FixedDepthVisitor> FixedDepthVisitor for LevelIter<T>
fn get_height(&self) -> usize
sourceimpl<T: Visitor> Visitor for LevelIter<T>
impl<T: Visitor> Visitor for LevelIter<T>
sourcefn next(self) -> (Self::Item, Option<[Self; 2]>)
fn next(self) -> (Self::Item, Option<[Self; 2]>)
Consume this visitor, and produce the element it was pointing to along with it’s children visitors. Read more
sourcefn level_remaining_hint(&self) -> (usize, Option<usize>)
fn level_remaining_hint(&self) -> (usize, Option<usize>)
Return the levels remaining including the one that will be produced by consuming this iterator. So if you first made this object from the root for a tree of size 5, it should return 5. Think of is as height-depth. This is used to make good allocations when doing dfs and bfs. Defaults to (0,None) Read more
sourcefn with_depth(self, start_depth: Depth) -> LevelIter<Self>
fn with_depth(self, start_depth: Depth) -> LevelIter<Self>
Iterator Adapter to also produce the depth each iteration.
sourcefn dfs_preorder_iter(self) -> DfsPreOrderIter<Self>ⓘNotable traits for DfsPreOrderIter<C>impl<C: Visitor> Iterator for DfsPreOrderIter<C> type Item = C::Item;
fn dfs_preorder_iter(self) -> DfsPreOrderIter<Self>ⓘNotable traits for DfsPreOrderIter<C>impl<C: Visitor> Iterator for DfsPreOrderIter<C> type Item = C::Item;
Provides a dfs preorder iterator. Unlike the callback version, This one relies on dynamic allocation for its stack. Read more
fn dfs_inorder_iter(self) -> DfsInOrderIter<Self>ⓘNotable traits for DfsInOrderIter<C>impl<C: Visitor> Iterator for DfsInOrderIter<C> type Item = C::Item;
sourcefn dfs_preorder(self, func: impl FnMut(Self::Item))
fn dfs_preorder(self, func: impl FnMut(Self::Item))
Calls the closure in dfs preorder (root,left,right). Takes advantage of the callstack to do dfs. Read more
sourcefn dfs_inorder(self, func: impl FnMut(Self::Item))
fn dfs_inorder(self, func: impl FnMut(Self::Item))
Calls the closure in dfs preorder (left,right,root). Takes advantage of the callstack to do dfs. Read more
sourcefn dfs_postorder(self, func: impl FnMut(Self::Item))
fn dfs_postorder(self, func: impl FnMut(Self::Item))
Calls the closure in dfs preorder (left,right,root). Takes advantage of the callstack to do dfs. Read more
Auto Trait Implementations
impl<T> RefUnwindSafe for LevelIter<T> where
T: RefUnwindSafe,
impl<T> Send for LevelIter<T> where
T: Send,
impl<T> Sync for LevelIter<T> where
T: Sync,
impl<T> Unpin for LevelIter<T> where
T: Unpin,
impl<T> UnwindSafe for LevelIter<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
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more