Trait rustc_middle::ty::TypeVisitable
source · pub trait TypeVisitable<I>: Debug + Clonewhere
I: Interner,{
// Required method
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Result
where V: TypeVisitor<I>;
}
Expand description
This trait is implemented for every type that can be visited, providing the skeleton of the traversal.
To implement this conveniently, use the derive macro located in
rustc_macros
.
Required Methods§
sourcefn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
The entry point for visiting. To visit a value t
with a visitor v
call: t.visit_with(v)
.
For most types, this just traverses the value, calling visit_with
on
each field/element.
For types of interest (such as Ty
), the implementation of this method
that calls a visitor method specifically for that type (such as
V::visit_ty
). This is where control transfers from TypeVisitable
to
TypeVisitor
.
Object Safety§
This trait is not object safe.