Node

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)
where V: Visit, Self: Sized,

Traverses this node with an immutable visitor.

fn visit_mut<V>(&mut self, visit: V)
where V: VisitMut,

Traverses this node with a mutable 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.

Implementations on Foreign Types§

§

impl<T> Node for Option<T>
where T: Node,

§

fn visit<V>(&self, visit: V)
where V: Visit, Option<T>: Sized,

§

fn visit_mut<V>(&mut self, visit: V)
where V: VisitMut,

§

impl<T> Node for &mut T
where T: Node,

§

fn visit<V>(&self, visit: V)
where V: Visit, &mut T: Sized,

§

fn visit_mut<V>(&mut self, visit: V)
where V: VisitMut,

Implementors§

§

impl Node for Assignment

§

impl Node for Expr

§

impl Node for Returning

§

impl Node for Condition

§

impl Node for Delete

§

impl Node for ExprInSubquery

§

impl Node for ExprRecord

§

impl Node for Filter

§

impl Node for Insert

§

impl Node for Query

§

impl Node for Select

§

impl Node for Update

§

impl Node for Statement