pub trait Visitor<'tree> {
type Error;
// Required method
fn visit_node(&self, node: Node<'tree>) -> Result<bool, Self::Error>;
}
Expand description
Trait used to enable visiting members of KCL AST.
Implementing this trait enables the implementer to be invoked over members of KCL AST by using the Visitable::visit function on a Node.
Required Associated Types§
Required Methods§
Sourcefn visit_node(&self, node: Node<'tree>) -> Result<bool, Self::Error>
fn visit_node(&self, node: Node<'tree>) -> Result<bool, Self::Error>
Visit a KCL AST Node.
In general, implementers likely wish to check to see if a Node is what they’re looking for, and either descend into that Node’s children (by calling Visitable::children on Node to get children nodes, calling Visitable::visit on each node of interest), or perform some action.