pub struct Zip<T1: Visitor, T2: Visitor> { /* private fields */ }Expand description
Tree visitor that zips up two separate visitors. If one of the iterators returns None for its children, this iterator will return None.
Implementations§
Trait Implementations§
Source§impl<T1: FixedDepthVisitor, T2: FixedDepthVisitor> FixedDepthVisitor for Zip<T1, T2>
impl<T1: FixedDepthVisitor, T2: FixedDepthVisitor> FixedDepthVisitor for Zip<T1, T2>
fn get_height(&self) -> usize
Source§impl<T1: Visitor, T2: Visitor> Visitor for Zip<T1, T2>
impl<T1: Visitor, T2: Visitor> Visitor for Zip<T1, T2>
Source§type Item = (<T1 as Visitor>::Item, <T2 as Visitor>::Item)
type Item = (<T1 as Visitor>::Item, <T2 as Visitor>::Item)
The common item produced for both leafs and non leafs.
Source§fn 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.
Source§fn 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)
Source§fn 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.
Source§fn dfs_preorder_iter(self) -> DfsPreOrderIter<Self> ⓘ
fn dfs_preorder_iter(self) -> DfsPreOrderIter<Self> ⓘ
Provides a dfs preorder iterator. Unlike the callback version,
This one relies on dynamic allocation for its stack.
fn dfs_inorder_iter(self) -> DfsInOrderIter<Self> ⓘ
Source§fn 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.
Source§fn 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.
Source§fn 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.
Auto Trait Implementations§
impl<T1, T2> Freeze for Zip<T1, T2>
impl<T1, T2> RefUnwindSafe for Zip<T1, T2>where
T1: RefUnwindSafe,
T2: RefUnwindSafe,
impl<T1, T2> Send for Zip<T1, T2>
impl<T1, T2> Sync for Zip<T1, T2>
impl<T1, T2> Unpin for Zip<T1, T2>
impl<T1, T2> UnwindSafe for Zip<T1, T2>where
T1: UnwindSafe,
T2: UnwindSafe,
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