[−][src]Module syn::visit
Syntax tree traversal to walk a shared borrow of a syntax tree.
Each method of the Visit
trait is a hook that can be overridden to
customize the behavior when visiting the corresponding type of node. By
default, every method recursively visits the substructure of the input
by invoking the right visitor method of each of its fields.
# use syn::{Attribute, BinOp, Expr, ExprBinary};
#
pub trait Visit<'ast> {
/* ... */
fn visit_expr_binary(&mut self, node: &'ast ExprBinary) {
for attr in &node.attrs {
self.visit_attribute(attr);
}
self.visit_expr(&*node.left);
self.visit_bin_op(&node.op);
self.visit_expr(&*node.right);
}
/* ... */
# fn visit_attribute(&mut self, node: &'ast Attribute);
# fn visit_expr(&mut self, node: &'ast Expr);
# fn visit_bin_op(&mut self, node: &'ast BinOp);
}
This module is available if Syn is built with the "visit"
feature.
Traits
Visit | Syntax tree traversal to walk a shared borrow of a syntax tree. |