Module syn::visit_mut

source ·
Expand description

Syntax tree traversal to mutate an exclusive borrow of a syntax tree in place.

Each method of the VisitMut trait is a hook that can be overridden to customize the behavior when mutating 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 VisitMut {
    /* ... */

    fn visit_expr_binary_mut(&mut self, node: &mut ExprBinary) {
        for attr in &mut node.attrs {
            self.visit_attribute_mut(attr);
        }
        self.visit_expr_mut(&mut *node.left);
        self.visit_bin_op_mut(&mut node.op);
        self.visit_expr_mut(&mut *node.right);
    }

    /* ... */
}

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

Traits

Syntax tree traversal to mutate an exclusive borrow of a syntax tree in place.

Functions