Trait datafusion_common::tree_node::TreeNodeVisitor
source · pub trait TreeNodeVisitor: Sized {
type Node: TreeNode;
// Provided methods
fn f_down(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion> { ... }
fn f_up(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion> { ... }
}
Expand description
Implements the visitor pattern
for recursively walking TreeNode
s.
A TreeNodeVisitor
allows one to express algorithms separately from the
code traversing the structure of the TreeNode
tree, making it easier to
add new types of tree nodes and algorithms.
When passed to TreeNode::visit
, TreeNodeVisitor::f_down
and
TreeNodeVisitor::f_up
are invoked recursively on the tree.
See TreeNodeRecursion
for more details on controlling the traversal.
Required Associated Types§
Provided Methods§
sourcefn f_down(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion>
fn f_down(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion>
Invoked before any children of node
are visited.
Default implementation simply continues the recursion.
sourcefn f_up(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion>
fn f_up(&mut self, _node: &Self::Node) -> Result<TreeNodeRecursion>
Invoked after all children of node
are visited.
Default implementation simply continues the recursion.
Object Safety§
This trait is not object safe.