pub trait TreeTraversal<T> {
// Required methods
fn dfs(&self) -> Descendants<'_, T>;
fn bfs(&self) -> BreadthFirstTraversal<'_, T> ⓘ;
fn left_boundary(&self) -> impl Iterator<Item = Self>;
fn right_boundary(&self) -> impl Iterator<Item = Self>;
}
Expand description
Extension trait adding traversal algorithms on trees.
Required Methods§
Sourcefn bfs(&self) -> BreadthFirstTraversal<'_, T> ⓘ
fn bfs(&self) -> BreadthFirstTraversal<'_, T> ⓘ
Iterates over descendants of node in breadth-first order.
Sourcefn left_boundary(&self) -> impl Iterator<Item = Self>
fn left_boundary(&self) -> impl Iterator<Item = Self>
Iterates over left boundary of node.
Sourcefn right_boundary(&self) -> impl Iterator<Item = Self>
fn right_boundary(&self) -> impl Iterator<Item = Self>
Iterates over right boundary of node.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'a, T: 'a> TreeTraversal<T> for NodeRef<'a, T>
impl<'a, T: 'a> TreeTraversal<T> for NodeRef<'a, T>
Source§fn dfs(&self) -> Descendants<'a, T>
fn dfs(&self) -> Descendants<'a, T>
Uses the built-in traversal algorithm, which is depth-first, though that is not documented: https://github.com/rust-scraper/ego-tree/issues/38
Source§fn bfs(&self) -> BreadthFirstTraversal<'a, T> ⓘ
fn bfs(&self) -> BreadthFirstTraversal<'a, T> ⓘ
Implements the standard BFS algorithm using a queue.