Trait datafusion_common::tree_node::TreeNodeVisitor
source · pub trait TreeNodeVisitor<'n>: Sized {
type Node: TreeNode;
// Provided methods
fn f_down(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion> { ... }
fn f_up(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion> { ... }
}
Expand description
A Visitor for recursively
inspecting TreeNode
s via TreeNode::visit
.
See TreeNode
for more details on available APIs
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.
§Return Value
The returns value of f_up
and f_down
specifies how the tree walk should
proceed. See TreeNodeRecursion
for details. If an Err
is returned,
the recursion stops immediately.
Note: If using the default implementations of TreeNodeVisitor::f_up
or
TreeNodeVisitor::f_down
that do nothing, consider using
TreeNode::apply
instead.
§See Also:
TreeNode::rewrite
to rewrite ownedTreeNode
s
Required Associated Types§
Provided Methods§
sourcefn f_down(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion>
fn f_down(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion>
Invoked while traversing down the tree, before any children are visited. Default implementation continues the recursion.
sourcefn f_up(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion>
fn f_up(&mut self, _node: &'n Self::Node) -> Result<TreeNodeRecursion>
Invoked while traversing up the tree after children are visited. Default implementation continues the recursion.