pub trait NodeVisitor {
// Required methods
fn consider_node(&self, node: VisitNode<'_>) -> VisitFlow;
fn enter_node(&mut self, node: VisitNode<'_>) -> VisitFlow;
fn exit_node(&mut self, node: VisitNode<'_>) -> VisitFlow;
}Expand description
The object-safe core of Visit.
Visit has methods that are type-specific. A visitor that needs the node kind and the span can implement just
this trait, and can then walk a node whose type is erased, such as an ErasedNode.
The methods have no defaults, thus an implementation cannot drop one by mistake.
Required Methods§
Sourcefn consider_node(&self, node: VisitNode<'_>) -> VisitFlow
fn consider_node(&self, node: VisitNode<'_>) -> VisitFlow
Called before entering a node.
Return VisitFlow::SKIP_CHILDREN to prune the node and its entire subtree (it is never entered). Return
VisitFlow::STOP to halt the whole traversal.
Sourcefn enter_node(&mut self, node: VisitNode<'_>) -> VisitFlow
fn enter_node(&mut self, node: VisitNode<'_>) -> VisitFlow
Called on entry to every queryable node.
Receives a VisitNode; per-node metadata and properties are available via its methods. Return
VisitFlow::SKIP_CHILDREN to skip the typed visit_* call and children.