pub trait Visitor {
// Provided methods
fn visit_program(&mut self, program: &Program) { ... }
fn visit_stmt(&mut self, stmt: &Stmt) { ... }
fn visit_expr(&mut self, expr: &Expr) { ... }
}Expand description
A read-only traversal over the AST.
Override the visit_* methods for the nodes you care about; call the
corresponding walk_* free function (or walk_expr/walk_stmt) from
your override to continue into child nodes. Omitting that call prunes the
subtree — occasionally useful, but usually you want to recurse.
Provided Methods§
fn visit_program(&mut self, program: &Program)
fn visit_stmt(&mut self, stmt: &Stmt)
fn visit_expr(&mut self, expr: &Expr)
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".