Trait compt::CTreeIterator
[−]
[src]
pub trait CTreeIterator: Sized { type Item; fn next(self) -> (Self::Item, Option<(Self, Self)>); fn zip<F: CTreeIterator>(self, f: F) -> Zip<Self, F> { ... } fn bfs_iter(self) -> BfsIter<Self> { ... } fn dfs_preorder_iter(self) -> DfsPreorderIter<Self> { ... } fn dfs_preorder<F: FnMut(Self::Item)>(self, func: F) { ... } fn dfs_postorder<F: FnMut(Self::Item)>(self, func: F) { ... } }
All binary tree visitors implement this.
Associated Types
type Item
Required Methods
fn next(self) -> (Self::Item, Option<(Self, Self)>)
Consume this visitor, and produce the element it was pointing to along with it's children visitors.
Provided Methods
fn zip<F: CTreeIterator>(self, f: F) -> Zip<Self, F>
Combine two tree visitors.
fn bfs_iter(self) -> BfsIter<Self>
Provides an iterator that returns each element in bfs order. A callback version is not provided because a queue would still need to be used, So it wouldnt be able to take advantage of the stack anyway.
fn dfs_preorder_iter(self) -> DfsPreorderIter<Self>
Provides a dfs preorder iterator. Unlike the callback version, This one relies on dynamic allocation for its queue.
fn dfs_preorder<F: FnMut(Self::Item)>(self, func: F)
Calls the closure in dfs preorder (left,right,root). Takes advantage of the callstack to do dfs.
fn dfs_postorder<F: FnMut(Self::Item)>(self, func: F)
Calls the closure in dfs postorder (right,left,root). Takes advantage of the callstack to do dfs.
Implementors
impl<'a, T: CTreeIterator + 'a> CTreeIterator for WrapGen<'a, T> type Item = Bo<'a, T::Item>;
impl<'a, T: Send + 'a> CTreeIterator for DownTMut<'a, T> type Item = &'a mut T;
impl<'a, T: Send + 'a> CTreeIterator for DownT<'a, T> type Item = &'a T;
impl<T1: CTreeIterator, T2: CTreeIterator> CTreeIterator for Zip<T1, T2> type Item = (T1::Item, T2::Item);
impl<T: CTreeIterator> CTreeIterator for LevelIter<T> type Item = (LevelDesc, T::Item);