Skip to main content

OwnedVisitor

Trait OwnedVisitor 

Source
pub trait OwnedVisitor {
    type Break;

Show 18 methods // Provided methods fn visit_program(&mut self, program: &Program) -> ControlFlow<Self::Break> { ... } fn visit_stmt(&mut self, stmt: &Stmt) -> ControlFlow<Self::Break> { ... } fn visit_block(&mut self, block: &Block) -> ControlFlow<Self::Break> { ... } fn visit_expr(&mut self, expr: &Expr) -> ControlFlow<Self::Break> { ... } fn visit_param(&mut self, param: &Param) -> ControlFlow<Self::Break> { ... } fn visit_arg(&mut self, arg: &Arg) -> ControlFlow<Self::Break> { ... } fn visit_class_member( &mut self, member: &ClassMember, ) -> ControlFlow<Self::Break> { ... } fn visit_enum_member( &mut self, member: &EnumMember, ) -> ControlFlow<Self::Break> { ... } fn visit_property_hook( &mut self, hook: &PropertyHook, ) -> ControlFlow<Self::Break> { ... } fn visit_type_hint( &mut self, type_hint: &TypeHint, ) -> ControlFlow<Self::Break> { ... } fn visit_attribute( &mut self, attribute: &Attribute, ) -> ControlFlow<Self::Break> { ... } fn visit_catch_clause( &mut self, catch: &CatchClause, ) -> ControlFlow<Self::Break> { ... } fn visit_match_arm(&mut self, arm: &MatchArm) -> ControlFlow<Self::Break> { ... } fn visit_closure_use_var( &mut self, _var: &ClosureUseVar, ) -> ControlFlow<Self::Break> { ... } fn visit_trait_use( &mut self, trait_use: &TraitUseDecl, ) -> ControlFlow<Self::Break> { ... } fn visit_trait_adaptation( &mut self, adaptation: &TraitAdaptation, ) -> ControlFlow<Self::Break> { ... } fn visit_name(&mut self, _name: &Name) -> ControlFlow<Self::Break> { ... } fn visit_comment(&mut self, _comment: &Comment) -> ControlFlow<Self::Break> { ... }
}
Expand description

Visitor trait for immutable traversal of owned (lifetime-free) AST nodes.

All methods return ControlFlow<Self::Break>:

  • ControlFlow::Continue(()) — keep walking.
  • ControlFlow::Break(value) — stop the entire traversal immediately; value is returned by the call that started the walk. Use type Break = (); when there is nothing to return.

Default implementations recurse into child nodes, so implementors only need to override the node types they care about.

To skip a subtree, override the method and return Continue(()) without calling the corresponding walk_owned_* function.

Required Associated Types§

Source

type Break

Value carried by ControlFlow::Break when a visit stops the walk early; use () to stop without a result.

Provided Methods§

Source

fn visit_program(&mut self, program: &Program) -> ControlFlow<Self::Break>

Visits a program node.

Source

fn visit_stmt(&mut self, stmt: &Stmt) -> ControlFlow<Self::Break>

Visits a statement node.

Source

fn visit_block(&mut self, block: &Block) -> ControlFlow<Self::Break>

Visits a block node.

Source

fn visit_expr(&mut self, expr: &Expr) -> ControlFlow<Self::Break>

Visits an expression node.

Source

fn visit_param(&mut self, param: &Param) -> ControlFlow<Self::Break>

Visits a param node.

Source

fn visit_arg(&mut self, arg: &Arg) -> ControlFlow<Self::Break>

Visits an arg node.

Source

fn visit_class_member( &mut self, member: &ClassMember, ) -> ControlFlow<Self::Break>

Visits a class member node.

Source

fn visit_enum_member(&mut self, member: &EnumMember) -> ControlFlow<Self::Break>

Visits an enum member node.

Source

fn visit_property_hook( &mut self, hook: &PropertyHook, ) -> ControlFlow<Self::Break>

Visits a property hook node.

Source

fn visit_type_hint(&mut self, type_hint: &TypeHint) -> ControlFlow<Self::Break>

Visits a type hint node.

Source

fn visit_attribute(&mut self, attribute: &Attribute) -> ControlFlow<Self::Break>

Visits an attribute node.

Source

fn visit_catch_clause( &mut self, catch: &CatchClause, ) -> ControlFlow<Self::Break>

Visits a catch clause node.

Source

fn visit_match_arm(&mut self, arm: &MatchArm) -> ControlFlow<Self::Break>

Visits a match arm node.

Source

fn visit_closure_use_var( &mut self, _var: &ClosureUseVar, ) -> ControlFlow<Self::Break>

Visits a closure use var node.

Source

fn visit_trait_use( &mut self, trait_use: &TraitUseDecl, ) -> ControlFlow<Self::Break>

Visits a trait use node.

Source

fn visit_trait_adaptation( &mut self, adaptation: &TraitAdaptation, ) -> ControlFlow<Self::Break>

Visits a trait adaptation node.

Source

fn visit_name(&mut self, _name: &Name) -> ControlFlow<Self::Break>

Visits a name node.

Source

fn visit_comment(&mut self, _comment: &Comment) -> ControlFlow<Self::Break>

Visits a comment node.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§