Module syn::visit

source ·
Expand description

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.

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);
    }

    /* ... */
}

This module is available if Syn is built with the "visit" feature.

Traits

Syntax tree traversal to walk a shared borrow of a syntax tree.

Functions