Trait repc::visitor::Visitor [−][src]
pub trait Visitor<I> where
I: Layout, {
fn visit_type(&mut self, ty: &Type<I>) { ... }
fn visit_annotations(&mut self, annotations: &[Annotation]) { ... }
fn visit_builtin_type(&mut self, builtin_type: BuiltinType, ty: &Type<I>) { ... }
fn visit_record(&mut self, record: &Record<I>, ty: &Type<I>) { ... }
fn visit_record_field(
&mut self,
field: &RecordField<I>,
record: &Record<I>,
ty: &Type<I>
) { ... }
fn visit_typedef(&mut self, dst: &Type<I>, ty: &Type<I>) { ... }
fn visit_array(&mut self, array: &Array<I>, ty: &Type<I>) { ... }
fn visit_opaque_type(
&mut self,
layout: <I as Layout>::OpaqueLayout,
ty: &Type<I>
) { ... }
fn visit_enum(&mut self, variants: &[i128], ty: &Type<I>) { ... }
}
Expand description
This trait represents a visitor that walks through a Type
.
Each method’s default implementation is accessible through the function of the same name in the
visitor
module.
Example
struct Impl;
impl<I: Layout> Visitor<I> for Impl {
fn visit_enum(&mut self, variants: &[i128], ty: &Type<I>) {
println!("Variants: {:?}", variants);
visit_enum(self, variants, ty)
}
}
Provided methods
fn visit_type(&mut self, ty: &Type<I>)
fn visit_type(&mut self, ty: &Type<I>)
Called for types.
fn visit_annotations(&mut self, annotations: &[Annotation])
fn visit_annotations(&mut self, annotations: &[Annotation])
Called for the annotations on a type or field.
fn visit_builtin_type(&mut self, builtin_type: BuiltinType, ty: &Type<I>)
fn visit_builtin_type(&mut self, builtin_type: BuiltinType, ty: &Type<I>)
Called for builtin types.
fn visit_record(&mut self, record: &Record<I>, ty: &Type<I>)
fn visit_record(&mut self, record: &Record<I>, ty: &Type<I>)
Called for records.
fn visit_record_field(
&mut self,
field: &RecordField<I>,
record: &Record<I>,
ty: &Type<I>
)
fn visit_record_field(
&mut self,
field: &RecordField<I>,
record: &Record<I>,
ty: &Type<I>
)
Called for record fields.
fn visit_typedef(&mut self, dst: &Type<I>, ty: &Type<I>)
fn visit_typedef(&mut self, dst: &Type<I>, ty: &Type<I>)
Called for typedefs.
fn visit_array(&mut self, array: &Array<I>, ty: &Type<I>)
fn visit_array(&mut self, array: &Array<I>, ty: &Type<I>)
Called for arrays.
fn visit_opaque_type(
&mut self,
layout: <I as Layout>::OpaqueLayout,
ty: &Type<I>
)
fn visit_opaque_type(
&mut self,
layout: <I as Layout>::OpaqueLayout,
ty: &Type<I>
)
Called for opaque types.