Skip to main content

TypeVisitable

Trait TypeVisitable 

Source
pub trait TypeVisitable<I: Interner>: Debug {
    // 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 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".

Implementations on Foreign Types§

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>, 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>, S> TypeVisitable<I> for IndexSet<T, S>

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

Source§

impl<I: Interner, T: TypeVisitable<I>, const N: usize> TypeVisitable<I> for SmallVec<[T; N]>

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 Arc<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 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 ThinVec<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> TypeVisitable<I> for ()

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 usize

Source§

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

Implementors§

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 Placeholder<I, T>
where I: Interner, T: TypeVisitable<I>,

Source§

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

Source§

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

Source§

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

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> TypeVisitable<I> for AliasRelationDirection

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<I: Interner> TypeVisitable<I> for rustc_type_ir::region_constraint::RegionConstraint<I>

Source§

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

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for AccessedOpaques<I>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for CoercePredicate<I>
where I: Interner, I::Ty: TypeVisitable<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>,

Source§

impl<I> TypeVisitable<I> for CoroutineWitnessTypes<I>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for ExternalRegionConstraints<I>

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for PatternKind<I>

Source§

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

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for rustc_type_ir::RegionConstraint<I>

Source§

impl<I> TypeVisitable<I> for RegionEqPredicate<I>
where I: Interner, I::Region: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for RerunCondition<I>

Source§

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

Source§

impl<I> TypeVisitable<I> for Response<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 TypeAndMut<I>
where I: Interner, I::Ty: TypeVisitable<I>,

Source§

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

Source§

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

Source§

impl<I> TypeVisitable<I> for UnsafeBinderInner<I>
where I: Interner, Binder<I, I::Ty>: TypeVisitable<I>,

Source§

impl<I> TypeVisitable<I> for ValTreeKind<I>

Source§

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

Source§

impl<T: Copy + Debug + Hash + Eq, I> TypeVisitable<I> for SmallCopyList<T>