pub trait TypeFolder<I: Interner>: FallibleTypeFolder<I, Error = !> {
    // Required method
    fn interner(&self) -> I;

    // Provided methods
    fn fold_binder<T>(&mut self, t: I::Binder<T>) -> I::Binder<T>
       where T: TypeFoldable<I>,
             I::Binder<T>: TypeSuperFoldable<I> { ... }
    fn fold_ty(&mut self, t: I::Ty) -> I::Ty
       where I::Ty: TypeSuperFoldable<I> { ... }
    fn fold_region(&mut self, r: I::Region) -> I::Region { ... }
    fn fold_const(&mut self, c: I::Const) -> I::Const
       where I::Const: TypeSuperFoldable<I> { ... }
    fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicate
       where I::Predicate: TypeSuperFoldable<I> { ... }
}
Expand description

This trait is implemented for every infallible folding traversal. There is a fold method defined for every type of interest. Each such method has a default that does an “identity” fold. Implementations of these methods often fall back to a super_fold_with method if the primary argument doesn’t satisfy a particular condition.

A blanket implementation of FallibleTypeFolder will defer to the infallible methods of this trait to ensure that the two APIs are coherent.

Required Methods§

source

fn interner(&self) -> I

Provided Methods§

source

fn fold_binder<T>(&mut self, t: I::Binder<T>) -> I::Binder<T>where T: TypeFoldable<I>, I::Binder<T>: TypeSuperFoldable<I>,

source

fn fold_ty(&mut self, t: I::Ty) -> I::Tywhere I::Ty: TypeSuperFoldable<I>,

source

fn fold_region(&mut self, r: I::Region) -> I::Region

source

fn fold_const(&mut self, c: I::Const) -> I::Constwhere I::Const: TypeSuperFoldable<I>,

source

fn fold_predicate(&mut self, p: I::Predicate) -> I::Predicatewhere I::Predicate: TypeSuperFoldable<I>,

Implementors§