Trait syntex_syntax::visit::Visitor [] [src]

pub trait Visitor<'v>: Sized {
    fn visit_name(&mut self, _span: Span, _name: Name) { ... }
    fn visit_ident(&mut self, span: Span, ident: Ident) { ... }
    fn visit_mod(&mut self, m: &'v Mod, _s: Span, _n: NodeId) { ... }
    fn visit_foreign_item(&mut self, i: &'v ForeignItem) { ... }
    fn visit_item(&mut self, i: &'v Item) { ... }
    fn visit_local(&mut self, l: &'v Local) { ... }
    fn visit_block(&mut self, b: &'v Block) { ... }
    fn visit_stmt(&mut self, s: &'v Stmt) { ... }
    fn visit_arm(&mut self, a: &'v Arm) { ... }
    fn visit_pat(&mut self, p: &'v Pat) { ... }
    fn visit_decl(&mut self, d: &'v Decl) { ... }
    fn visit_expr(&mut self, ex: &'v Expr) { ... }
    fn visit_expr_post(&mut self, _ex: &'v Expr) { ... }
    fn visit_ty(&mut self, t: &'v Ty) { ... }
    fn visit_generics(&mut self, g: &'v Generics) { ... }
    fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: &'v Block, s: Span, _: NodeId) { ... }
    fn visit_trait_item(&mut self, ti: &'v TraitItem) { ... }
    fn visit_impl_item(&mut self, ii: &'v ImplItem) { ... }
    fn visit_trait_ref(&mut self, t: &'v TraitRef) { ... }
    fn visit_ty_param_bound(&mut self, bounds: &'v TyParamBound) { ... }
    fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef, m: &'v TraitBoundModifier) { ... }
    fn visit_variant_data(&mut self, s: &'v VariantData, _: Ident, _: &'v Generics, _: NodeId, _: Span) { ... }
    fn visit_struct_field(&mut self, s: &'v StructField) { ... }
    fn visit_enum_def(&mut self, enum_definition: &'v EnumDef, generics: &'v Generics, item_id: NodeId, _: Span) { ... }
    fn visit_variant(&mut self, v: &'v Variant, g: &'v Generics, item_id: NodeId) { ... }
    fn visit_lifetime(&mut self, lifetime: &'v Lifetime) { ... }
    fn visit_lifetime_def(&mut self, lifetime: &'v LifetimeDef) { ... }
    fn visit_explicit_self(&mut self, es: &'v ExplicitSelf) { ... }
    fn visit_mac(&mut self, _mac: &'v Mac) { ... }
    fn visit_path(&mut self, path: &'v Path, _id: NodeId) { ... }
    fn visit_path_list_item(&mut self, prefix: &'v Path, item: &'v PathListItem) { ... }
    fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment) { ... }
    fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &'v PathParameters) { ... }
    fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding) { ... }
    fn visit_attribute(&mut self, _attr: &'v Attribute) { ... }
    fn visit_macro_def(&mut self, macro_def: &'v MacroDef) { ... }
}

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

fn visit_name(&mut self, _span: Span, _name: Name)

fn visit_ident(&mut self, span: Span, ident: Ident)

fn visit_mod(&mut self, m: &'v Mod, _s: Span, _n: NodeId)

fn visit_foreign_item(&mut self, i: &'v ForeignItem)

fn visit_item(&mut self, i: &'v Item)

fn visit_local(&mut self, l: &'v Local)

fn visit_block(&mut self, b: &'v Block)

fn visit_stmt(&mut self, s: &'v Stmt)

fn visit_arm(&mut self, a: &'v Arm)

fn visit_pat(&mut self, p: &'v Pat)

fn visit_decl(&mut self, d: &'v Decl)

fn visit_expr(&mut self, ex: &'v Expr)

fn visit_expr_post(&mut self, _ex: &'v Expr)

fn visit_ty(&mut self, t: &'v Ty)

fn visit_generics(&mut self, g: &'v Generics)

fn visit_fn(&mut self, fk: FnKind<'v>, fd: &'v FnDecl, b: &'v Block, s: Span, _: NodeId)

fn visit_trait_item(&mut self, ti: &'v TraitItem)

fn visit_impl_item(&mut self, ii: &'v ImplItem)

fn visit_trait_ref(&mut self, t: &'v TraitRef)

fn visit_ty_param_bound(&mut self, bounds: &'v TyParamBound)

fn visit_poly_trait_ref(&mut self, t: &'v PolyTraitRef, m: &'v TraitBoundModifier)

fn visit_variant_data(&mut self, s: &'v VariantData, _: Ident, _: &'v Generics, _: NodeId, _: Span)

fn visit_struct_field(&mut self, s: &'v StructField)

fn visit_enum_def(&mut self, enum_definition: &'v EnumDef, generics: &'v Generics, item_id: NodeId, _: Span)

fn visit_variant(&mut self, v: &'v Variant, g: &'v Generics, item_id: NodeId)

fn visit_lifetime(&mut self, lifetime: &'v Lifetime)

fn visit_lifetime_def(&mut self, lifetime: &'v LifetimeDef)

fn visit_explicit_self(&mut self, es: &'v ExplicitSelf)

fn visit_mac(&mut self, _mac: &'v Mac)

fn visit_path(&mut self, path: &'v Path, _id: NodeId)

fn visit_path_list_item(&mut self, prefix: &'v Path, item: &'v PathListItem)

fn visit_path_segment(&mut self, path_span: Span, path_segment: &'v PathSegment)

fn visit_path_parameters(&mut self, path_span: Span, path_parameters: &'v PathParameters)

fn visit_assoc_type_binding(&mut self, type_binding: &'v TypeBinding)

fn visit_attribute(&mut self, _attr: &'v Attribute)

fn visit_macro_def(&mut self, macro_def: &'v MacroDef)

Implementors