Trait Node
pub trait Node: Debug {
// Required methods
fn visit<V>(&self, visit: V)
where V: Visit,
Self: Sized;
fn visit_mut<V>(&mut self, visit: V)
where V: VisitMut;
}Expand description
A node in the statement AST that can be traversed by a visitor.
Every AST type (statements, expressions, values, etc.) implements Node
to participate in the visitor pattern defined by Visit and
VisitMut.
§Examples
ⓘ
use toasty_core::stmt::{Node, Expr, Value, visit};
let expr = Expr::from(Value::from(42_i64));
visit::for_each_expr(&expr, |e| {
println!("{:?}", e);
});Required Methods§
fn visit<V>(&self, visit: V)
fn visit<V>(&self, visit: V)
Traverses this node with an immutable visitor.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.