rustc_type_ir::visit

Trait TypeVisitable

source
pub trait TypeVisitable<I: Interner>: Debug + Clone {
    // Required method
    fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result;
}
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§

source

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

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<I: Interner> TypeVisitable<I> for Movability

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for Mutability

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for bool

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for u16

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for u32

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for u64

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for ()

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for usize

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner> TypeVisitable<I> for String

source§

fn visit_with<F: TypeVisitor<I>>(&self, _: &mut F) -> F::Result

source§

impl<I: Interner, A: TypeVisitable<I>, B: TypeVisitable<I>, C: TypeVisitable<I>> TypeVisitable<I> for (A, B, C)

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for &[T]

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Option<T>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<[T]>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Box<T>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Vec<T>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for ThinVec<T>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>, E: TypeVisitable<I>> TypeVisitable<I> for Result<T, E>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>, Ix: Idx> TypeVisitable<I> for IndexVec<Ix, T>

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

source§

impl<I: Interner, T: TypeVisitable<I>, U: TypeVisitable<I>> TypeVisitable<I> for (T, U)

source§

fn visit_with<V: TypeVisitor<I>>(&self, visitor: &mut V) -> V::Result

Implementors§

source§

impl<I> TypeVisitable<I> for CanonicalTyVarKind
where I: Interner,

source§

impl<I> TypeVisitable<I> for CanonicalVarKind<I>

source§

impl<I> TypeVisitable<I> for TypeError<I>

source§

impl<I> TypeVisitable<I> for ExistentialPredicate<I>

source§

impl<I> TypeVisitable<I> for ClauseKind<I>

source§

impl<I> TypeVisitable<I> for PredicateKind<I>

source§

impl<I> TypeVisitable<I> for ProbeKind<I>

source§

impl<I> TypeVisitable<I> for CanonicalVarInfo<I>

source§

impl<I> TypeVisitable<I> for CanonicalVarValues<I>

source§

impl<I> TypeVisitable<I> for UnevaluatedConst<I>

source§

impl<I> TypeVisitable<I> for OpaqueTypeKey<I>

source§

impl<I> TypeVisitable<I> for AliasTerm<I>

source§

impl<I> TypeVisitable<I> for CoercePredicate<I>
where I: Interner, I::Ty: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for ExistentialProjection<I>

source§

impl<I> TypeVisitable<I> for ExistentialTraitRef<I>

source§

impl<I> TypeVisitable<I> for NormalizesTo<I>

source§

impl<I> TypeVisitable<I> for ProjectionPredicate<I>

source§

impl<I> TypeVisitable<I> for SubtypePredicate<I>
where I: Interner, I::Ty: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for TraitPredicate<I>
where I: Interner, TraitRef<I>: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for TraitRef<I>

source§

impl<I> TypeVisitable<I> for ExternalConstraintsData<I>

source§

impl<I> TypeVisitable<I> for NestedNormalizationGoals<I>

source§

impl<I> TypeVisitable<I> for PredefinedOpaquesData<I>
where I: Interner, Vec<(OpaqueTypeKey<I>, I::Ty)>: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for Response<I>

source§

impl<I> TypeVisitable<I> for ClosureArgs<I>

source§

impl<I> TypeVisitable<I> for CoroutineArgs<I>

source§

impl<I> TypeVisitable<I> for CoroutineClosureArgs<I>

source§

impl<I> TypeVisitable<I> for CoroutineClosureSignature<I>
where I: Interner, I::Ty: TypeVisitable<I>, I::Safety: TypeVisitable<I>, I::Abi: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for GenSig<I>
where I: Interner, I::Ty: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for AliasTy<I>

source§

impl<I> TypeVisitable<I> for FnHeader<I>
where I: Interner, I::Safety: TypeVisitable<I>, I::Abi: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for FnSig<I>
where I: Interner, I::Tys: TypeVisitable<I>, I::Safety: TypeVisitable<I>, I::Abi: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for FnSigTys<I>
where I: Interner, I::Tys: TypeVisitable<I>,

source§

impl<I> TypeVisitable<I> for TypeAndMut<I>
where I: Interner, I::Ty: TypeVisitable<I>,

source§

impl<I, A> TypeVisitable<I> for OutlivesPredicate<I, A>
where I: Interner, A: TypeVisitable<I>, I::Region: TypeVisitable<I>,

source§

impl<I, P> TypeVisitable<I> for Goal<I, P>
where I: Interner, I::ParamEnv: TypeVisitable<I>, P: TypeVisitable<I>,

source§

impl<I, P> TypeVisitable<I> for QueryInput<I, P>

source§

impl<I, T> TypeVisitable<I> for State<I, T>

source§

impl<I, V> TypeVisitable<I> for Canonical<I, V>

source§

impl<I: Interner> TypeVisitable<I> for Variance

source§

impl<I: Interner> TypeVisitable<I> for BoundConstness

source§

impl<I: Interner> TypeVisitable<I> for PredicatePolarity

source§

impl<I: Interner> TypeVisitable<I> for AliasRelationDirection

source§

impl<I: Interner> TypeVisitable<I> for BuiltinImplSource

source§

impl<I: Interner> TypeVisitable<I> for Certainty

source§

impl<I: Interner> TypeVisitable<I> for GoalSource

source§

impl<I: Interner> TypeVisitable<I> for MaybeCause

source§

impl<I: Interner> TypeVisitable<I> for AliasTyKind

source§

impl<I: Interner> TypeVisitable<I> for FloatTy

source§

impl<I: Interner> TypeVisitable<I> for InferTy

source§

impl<I: Interner> TypeVisitable<I> for IntVarValue

source§

impl<I: Interner> TypeVisitable<I> for RegionVid

source§

impl<I: Interner> TypeVisitable<I> for NoSolution

source§

impl<I: Interner> TypeVisitable<I> for DebruijnIndex

source§

impl<I: Interner> TypeVisitable<I> for UniverseIndex

source§

impl<I: Interner, T> !TypeVisitable<I> for EarlyBinder<I, T>

For early binders, you should first call instantiate before using any visitors.

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Binder<I, T>

source§

impl<I: Interner, T: TypeVisitable<I>> TypeVisitable<I> for Lrc<T>

source§

impl<T, I> TypeVisitable<I> for ExpectedFound<T>
where I: Interner, T: TypeVisitable<I>,