# 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 Lrc<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: Interner> TypeVisitable<I> for CanonicalVarKind<I>
where I::Ty: TypeVisitable<I>,

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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

source§

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