Trait TypeVisitable
pub trait TypeVisitable<I>: Debugwhere
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§
fn 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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.
Implementations on Foreign Types§
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmTemplatePiece
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmTemplatePiece
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for CoroutineKind
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for CoroutineKind
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for MatchSource
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for MatchSource
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for RangeEnd
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for RangeEnd
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmRegOrRegClass
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmRegOrRegClass
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for FieldIdx
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for FieldIdx
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>>
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for TyAndLayout<'tcx, Ty<'tcx>>
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> V::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for VariantIdx
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for VariantIdx
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmOptions
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for InlineAsmOptions
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for HirId
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for HirId
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for DefId
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for DefId
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for LocalDefId
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for LocalDefId
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Span
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Span
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ErrorGuaranteed
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for ErrorGuaranteed
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> V::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Ident
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Ident
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Symbol
impl<'tcx> TypeVisitable<TyCtxt<'tcx>> for Symbol
fn visit_with<F: TypeVisitor<TyCtxt<'tcx>>>(&self, _: &mut F) -> F::Result
Source§impl<'tcx, T: TypeVisitable<TyCtxt<'tcx>> + Debug + Clone> TypeVisitable<TyCtxt<'tcx>> for Spanned<T>
impl<'tcx, T: TypeVisitable<TyCtxt<'tcx>> + Debug + Clone> TypeVisitable<TyCtxt<'tcx>> for Spanned<T>
fn visit_with<V: TypeVisitor<TyCtxt<'tcx>>>(&self, visitor: &mut V) -> V::Result
§impl<I> TypeVisitable<I> for boolwhere
I: Interner,
impl<I> TypeVisitable<I> for boolwhere
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I> TypeVisitable<I> for u16where
I: Interner,
impl<I> TypeVisitable<I> for u16where
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I> TypeVisitable<I> for u32where
I: Interner,
impl<I> TypeVisitable<I> for u32where
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I> TypeVisitable<I> for u64where
I: Interner,
impl<I> TypeVisitable<I> for u64where
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I> TypeVisitable<I> for ()where
I: Interner,
impl<I> TypeVisitable<I> for ()where
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I> TypeVisitable<I> for usizewhere
I: Interner,
impl<I> TypeVisitable<I> for usizewhere
I: Interner,
fn visit_with<F>(&self, _: &mut F) -> <F as TypeVisitor<I>>::Resultwhere
F: TypeVisitor<I>,
§impl<I, A, B, C> TypeVisitable<I> for (A, B, C)
impl<I, A, B, C> TypeVisitable<I> for (A, B, C)
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for &[T]where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for &[T]where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for Option<T>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Option<T>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for Box<[T]>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Box<[T]>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for Box<T>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Box<T>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for Arc<T>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Arc<T>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for Vec<T>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for Vec<T>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T> TypeVisitable<I> for ThinVec<T>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T> TypeVisitable<I> for ThinVec<T>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T, E> TypeVisitable<I> for Result<T, E>
impl<I, T, E> TypeVisitable<I> for Result<T, E>
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T, Ix> TypeVisitable<I> for IndexVec<Ix, T>
impl<I, T, Ix> TypeVisitable<I> for IndexVec<Ix, T>
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T, S> TypeVisitable<I> for IndexSet<T, S>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T, S> TypeVisitable<I> for IndexSet<T, S>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T, U> TypeVisitable<I> for (T, U)
impl<I, T, U> TypeVisitable<I> for (T, U)
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
§impl<I, T, const N: usize> TypeVisitable<I> for SmallVec<[T; N]>where
I: Interner,
T: TypeVisitable<I>,
impl<I, T, const N: usize> TypeVisitable<I> for SmallVec<[T; N]>where
I: Interner,
T: TypeVisitable<I>,
fn visit_with<V>(&self, visitor: &mut V) -> <V as TypeVisitor<I>>::Resultwhere
V: TypeVisitor<I>,
Implementors§
impl<I, T> !TypeVisitable<I> for EarlyBinder<I, T>where
I: Interner,
nightly only.For early binders, you should first call instantiate before using any visitors.