# Trait rustc_type_ir::visit::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`.

## Object Safety§

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>, 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>
where I: Interner, I::PlaceholderTy: TypeVisitable<I>, I::PlaceholderRegion: TypeVisitable<I>, I::PlaceholderConst: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for TypeError<I>
where I: Interner, ExpectedFound<I::Safety>: TypeVisitable<I>, ExpectedFound<I::Abi>: TypeVisitable<I>, I::Region: TypeVisitable<I>, I::BoundRegion: TypeVisitable<I>, ExpectedFound<I::Ty>: TypeVisitable<I>, ExpectedFound<I::DefId>: TypeVisitable<I>, I::Ty: TypeVisitable<I>, I::Const: TypeVisitable<I>, ExpectedFound<I::BoundExistentialPredicates>: TypeVisitable<I>, ExpectedFound<I::Const>: TypeVisitable<I>, I::DefId: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ExistentialPredicate<I>
where I: Interner, ExistentialTraitRef<I>: TypeVisitable<I>, ExistentialProjection<I>: TypeVisitable<I>, I::DefId: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ClauseKind<I>
where I: Interner, TraitPredicate<I>: TypeVisitable<I>, OutlivesPredicate<I, I::Region>: TypeVisitable<I>, OutlivesPredicate<I, I::Ty>: TypeVisitable<I>, ProjectionPredicate<I>: TypeVisitable<I>, I::Const: TypeVisitable<I>, I::Ty: TypeVisitable<I>, I::GenericArg: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for PredicateKind<I>
where I: Interner, ClauseKind<I>: TypeVisitable<I>, I::DefId: TypeVisitable<I>, SubtypePredicate<I>: TypeVisitable<I>, CoercePredicate<I>: TypeVisitable<I>, I::Const: TypeVisitable<I>, NormalizesTo<I>: TypeVisitable<I>, I::Term: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ProbeKind<I>
where I: Interner, QueryResult<I>: TypeVisitable<I>, CandidateSource<I>: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for CanonicalVarInfo<I>
where I: Interner, CanonicalVarKind<I>: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for CanonicalVarValues<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for UnevaluatedConst<I>
where I: Interner, I::DefId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for OpaqueTypeKey<I>
where I: Interner, I::LocalDefId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for AliasTerm<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>, I::DefId: TypeVisitable<I>,

source§

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

source§

### impl<I> TypeVisitable<I> for ExistentialProjection<I>
where I: Interner, I::DefId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>, I::Term: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ExistentialTraitRef<I>
where I: Interner, I::DefId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for NormalizesTo<I>
where I: Interner, AliasTerm<I>: TypeVisitable<I>, I::Term: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ProjectionPredicate<I>
where I: Interner, AliasTerm<I>: TypeVisitable<I>, I::Term: TypeVisitable<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>
where I: Interner, I::DefId: TypeVisitable<I>, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ExternalConstraintsData<I>
where I: Interner, Vec<OutlivesPredicate<I, I::GenericArg>>: TypeVisitable<I>, Vec<(OpaqueTypeKey<I>, I::Ty)>: TypeVisitable<I>, NestedNormalizationGoals<I>: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for NestedNormalizationGoals<I>
where I: Interner, Vec<(GoalSource, Goal<I, I::Predicate>)>: TypeVisitable<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>
where I: Interner, CanonicalVarValues<I>: TypeVisitable<I>, I::ExternalConstraints: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for ClosureArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for CoroutineArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<I>,

source§

### impl<I> TypeVisitable<I> for CoroutineClosureArgs<I>
where I: Interner, I::GenericArgs: TypeVisitable<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>
where I: Interner, I::GenericArgs: TypeVisitable<I>, I::DefId: 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 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>
where I: Interner, Goal<I, P>: TypeVisitable<I>, I::PredefinedOpaques: TypeVisitable<I>,

source§

### impl<I, T> TypeVisitable<I> for State<I, T>
where I: Interner, CanonicalVarValues<I>: TypeVisitable<I>, T: TypeVisitable<I>,

source§

### impl<I, V> TypeVisitable<I> for Canonical<I, V>
where I: Interner, V: TypeVisitable<I>, I::DefiningOpaqueTypes: TypeVisitable<I>, I::CanonicalVars: TypeVisitable<I>,

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>,