Trait Visitor
Source pub trait Visitor<'hir> {
type Result: VisitorResult;
type Ctx: VisitorCtx<'hir>;
Show 38 methods
// Required method
fn get_ctx(&mut self) -> &mut Self::Ctx;
// Provided methods
fn visit_module(&mut self, m: &'hir Module<'hir>) -> Self::Result { ... }
fn visit_param(&mut self, param: &'hir Param<'hir>) -> Self::Result { ... }
fn visit_item(&mut self, item: &'hir Item<'hir>) -> Self::Result { ... }
fn visit_use(
&mut self,
item: &'hir Item<'hir>,
u: &'hir UseItem<'hir>,
) -> Self::Result { ... }
fn visit_type_alias(
&mut self,
item: &'hir Item<'hir>,
ty: &'hir Type<'hir>,
name: &'hir PathDef,
) -> Self::Result { ... }
fn visit_variable_definition(
&mut self,
base: &'hir Item<'hir>,
name: &'hir PathDef,
ty: Option<&'hir Type<'hir>>,
init: Option<&'hir Expression<'hir>>,
constness: Constness,
) -> Self::Result { ... }
fn visit_expression(&mut self, expr: &'hir Expression<'hir>) -> Self::Result { ... }
fn visit_expression_as_stmt(
&mut self,
_base: &'hir Statement<'hir>,
expr: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_ref(
&mut self,
_base: &'hir Expression<'hir>,
r: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_cast(
&mut self,
_base: &'hir Expression<'hir>,
expr: &'hir Expression<'hir>,
to: &'hir Type<'hir>,
) -> Self::Result { ... }
fn visit_deref(
&mut self,
_base: &'hir Expression<'hir>,
r: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_unary(
&mut self,
_op: &UnaryOp,
expr: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_logical(
&mut self,
_base: &'hir Expression<'hir>,
left: &'hir Expression<'hir>,
op: &LogicalOp,
right: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_comparison(
&mut self,
_base: &'hir Expression<'hir>,
left: &'hir Expression<'hir>,
op: &CmpOp,
right: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_arithmetic(
&mut self,
_base: &'hir Expression<'hir>,
left: &'hir Expression<'hir>,
op: &ArithmeticOp,
right: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_ternary(
&mut self,
_base: &'hir Expression<'hir>,
cond: &'hir Expression<'hir>,
if_true: &'hir Expression<'hir>,
if_false: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_assignment(
&mut self,
_base: &'hir Expression<'hir>,
left: &'hir Expression<'hir>,
right: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_variable(
&mut self,
_base: &'hir Expression<'hir>,
path: &'hir Path,
) -> Self::Result { ... }
fn visit_function_definition(
&mut self,
_is_extern: bool,
_is_variadic: bool,
base: &'hir Item<'hir>,
name: &'hir PathDef,
params: &'hir [Param<'hir>],
ret_ty: &'hir Type<'hir>,
body: Option<&'hir [Statement<'hir>]>,
) -> Self::Result { ... }
fn visit_struct_definition(
&mut self,
base: &'hir Item<'hir>,
name: &'hir PathDef,
fields: &'hir [Field<'hir>],
) -> Self::Result { ... }
fn visit_field(
&mut self,
_def: &'hir Item<'hir>,
param: &'hir Field<'hir>,
) -> Self::Result { ... }
fn visit_statement(&mut self, stmt: &'hir Statement<'hir>) -> Self::Result { ... }
fn visit_block(
&mut self,
_base: &'hir Statement<'hir>,
block: &'hir [Statement<'hir>],
) -> Self::Result { ... }
fn visit_break(&mut self, _base: &'hir Statement<'hir>) -> Self::Result { ... }
fn visit_empty(&mut self, _base: &'hir Statement<'hir>) -> Self::Result { ... }
fn visit_continue(&mut self, _base: &'hir Statement<'hir>) -> Self::Result { ... }
fn visit_return(
&mut self,
_base: &'hir Statement<'hir>,
ret: Option<&'hir Expression<'hir>>,
) -> Self::Result { ... }
fn visit_literal(
&mut self,
_expr: &'hir Expression<'hir>,
_lit: &LitValue,
) -> Self::Result { ... }
fn visit_pathdef(
&mut self,
_owner: HirId,
_pdef: &'hir PathDef,
) -> Self::Result { ... }
fn visit_path(&mut self, _path: &'hir Path) -> Self::Result { ... }
fn visit_for(
&mut self,
_base: &'hir Statement<'_>,
init: Option<&'hir Item<'hir>>,
cond: Option<&'hir Expression<'hir>>,
inc: Option<&'hir Expression<'hir>>,
body: &'hir Statement<'hir>,
) -> Self::Result { ... }
fn visit_while(
&mut self,
_base: &'hir Statement<'_>,
cond: &'hir Expression<'hir>,
body: &'hir Statement<'hir>,
) -> Self::Result { ... }
fn visit_if(
&mut self,
_base: &'hir Statement<'_>,
cond: &'hir Expression<'hir>,
if_true: &'hir Statement<'hir>,
if_false: Option<&'hir Statement<'hir>>,
) -> Self::Result { ... }
fn visit_call(
&mut self,
_expr: &'hir Expression<'hir>,
callee: &'hir Expression<'hir>,
args: &'hir [Expression<'hir>],
) -> Self::Result { ... }
fn visit_array_access(
&mut self,
_expr: &'hir Expression<'hir>,
array: &'hir Expression<'hir>,
index: &'hir Expression<'hir>,
) -> Self::Result { ... }
fn visit_struct_access(
&mut self,
_expr: &'hir Expression<'hir>,
st: &'hir Expression<'hir>,
field: Ident,
) -> Self::Result { ... }
fn visit_type(&mut self, ty: &'hir Type<'hir>) -> Self::Result { ... }
}