Trait syn::visit::Visitor [] [src]

pub trait Visitor: Sized {
    fn visit_ident(&mut self, _ident: &Ident) { ... }
fn visit_derive_input(&mut self, derive_input: &DeriveInput) { ... }
fn visit_ty(&mut self, ty: &Ty) { ... }
fn visit_generics(&mut self, generics: &Generics) { ... }
fn visit_ty_param_bound(&mut self, bound: &TyParamBound) { ... }
fn visit_poly_trait_ref(
        &mut self,
        trait_ref: &PolyTraitRef,
        modifier: &TraitBoundModifier
    ) { ... }
fn visit_variant_data(
        &mut self,
        data: &VariantData,
        _ident: &Ident,
        _generics: &Generics
    ) { ... }
fn visit_field(&mut self, field: &Field) { ... }
fn visit_variant(&mut self, variant: &Variant, generics: &Generics) { ... }
fn visit_lifetime(&mut self, _lifetime: &Lifetime) { ... }
fn visit_lifetime_def(&mut self, lifetime: &LifetimeDef) { ... }
fn visit_path(&mut self, path: &Path) { ... }
fn visit_path_segment(&mut self, path_segment: &PathSegment) { ... }
fn visit_path_parameters(&mut self, path_parameters: &PathParameters) { ... }
fn visit_assoc_type_binding(&mut self, type_binding: &TypeBinding) { ... }
fn visit_attribute(&mut self, _attr: &Attribute) { ... }
fn visit_fn_ret_ty(&mut self, ret_ty: &FunctionRetTy) { ... }
fn visit_const_expr(&mut self, expr: &ConstExpr) { ... }
fn visit_lit(&mut self, _lit: &Lit) { ... }
fn visit_mac(&mut self, mac: &Mac) { ... } }

Each method of the Visitor trait is a hook to be potentially overridden. Each method's default implementation recursively visits the substructure of the input via the corresponding walk method; e.g. the visit_mod method by default calls visit::walk_mod.

If you want to ensure that your code handles every variant explicitly, you need to override each method. (And you also need to monitor future changes to Visitor in case a new method with a new default implementation gets introduced.)

Provided Methods

Implementors