pub enum TreeNodeRecursion {
Continue,
Jump,
Stop,
}
Expand description
Controls how TreeNode
recursions should proceed.
Variants§
Continue
Continue recursion with the next node.
Jump
In top-down traversals, skip recursing into children but continue with the next node, which actually means pruning of the subtree.
In bottom-up traversals, bypass calling bottom-up closures till the next leaf node.
In combined traversals, if it is the f_down
(pre-order) phase, execution
“jumps” to the next f_up
(post-order) phase by shortcutting its children.
If it is the f_up
(post-order) phase, execution “jumps” to the next f_down
(pre-order) phase by shortcutting its parent nodes until the first parent node
having unvisited children path.
Stop
Stop recursion.
Implementations§
Source§impl TreeNodeRecursion
impl TreeNodeRecursion
Sourcepub fn visit_children<F: FnOnce() -> Result<TreeNodeRecursion>>(
self,
f: F,
) -> Result<TreeNodeRecursion>
pub fn visit_children<F: FnOnce() -> Result<TreeNodeRecursion>>( self, f: F, ) -> Result<TreeNodeRecursion>
Continues visiting nodes with f
depending on the current TreeNodeRecursion
value and the fact that f
is visiting the current node’s children.
Sourcepub fn visit_sibling<F: FnOnce() -> Result<TreeNodeRecursion>>(
self,
f: F,
) -> Result<TreeNodeRecursion>
pub fn visit_sibling<F: FnOnce() -> Result<TreeNodeRecursion>>( self, f: F, ) -> Result<TreeNodeRecursion>
Continues visiting nodes with f
depending on the current TreeNodeRecursion
value and the fact that f
is visiting the current node’s sibling.
Sourcepub fn visit_parent<F: FnOnce() -> Result<TreeNodeRecursion>>(
self,
f: F,
) -> Result<TreeNodeRecursion>
pub fn visit_parent<F: FnOnce() -> Result<TreeNodeRecursion>>( self, f: F, ) -> Result<TreeNodeRecursion>
Continues visiting nodes with f
depending on the current TreeNodeRecursion
value and the fact that f
is visiting the current node’s parent.
Trait Implementations§
Source§impl Clone for TreeNodeRecursion
impl Clone for TreeNodeRecursion
Source§fn clone(&self) -> TreeNodeRecursion
fn clone(&self) -> TreeNodeRecursion
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more