pub trait Visitor {
type Output;
type Error;
// Required methods
fn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>;
fn visit_condition(
&mut self,
condition: &Condition,
) -> Result<Self::Output, Self::Error>;
fn visit_action(
&mut self,
action: &Action,
) -> Result<Self::Output, Self::Error>;
fn visit_description(
&mut self,
description: &Description,
) -> Result<Self::Output, Self::Error>;
}Expand description
A trait for visiting a tree AST in depth-first order.
All implementors of Visitor must provide a visit_root implementation.
This is usually the entry point of the visitor, though it is best if this
assumption is not held.
Required Associated Types§
Required Methods§
Sourcefn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>
fn visit_root(&mut self, root: &Root) -> Result<Self::Output, Self::Error>
This method is called on a root node.
Sourcefn visit_condition(
&mut self,
condition: &Condition,
) -> Result<Self::Output, Self::Error>
fn visit_condition( &mut self, condition: &Condition, ) -> Result<Self::Output, Self::Error>
This method is called on a condition node.
Sourcefn visit_action(&mut self, action: &Action) -> Result<Self::Output, Self::Error>
fn visit_action(&mut self, action: &Action) -> Result<Self::Output, Self::Error>
This method is called on an action node.
Sourcefn visit_description(
&mut self,
description: &Description,
) -> Result<Self::Output, Self::Error>
fn visit_description( &mut self, description: &Description, ) -> Result<Self::Output, Self::Error>
This method is called on an action description node.