Trait chalk_ir::fold::Fold[][src]

pub trait Fold<I: Interner>: Debug {
    type Result;
    fn fold_with<'i>(
        self,
        folder: &mut dyn Folder<'i, I>,
        outer_binder: DebruijnIndex
    ) -> Fallible<Self::Result>
    where
        I: 'i
; }
Expand description

Applies the given Folder to a value, producing a folded result of type Self::Result. The result type is typically the same as the source type, but in some cases we convert from borrowed to owned as well (e.g., the folder for &T will fold to a fresh T; well, actually T::Result).

Associated Types

The type of value that will be produced once folding is done. Typically this is Self, unless Self contains borrowed values, in which case owned values are produced (for example, one can fold over a &T value where T: Fold, in which case you get back a T, not a &T).

Required methods

Apply the given folder folder to self; binders is the number of binders that are in scope when beginning the folder. Typically binders starts as 0, but is adjusted when we encounter Binders<T> in the IR or other similar constructs.

Implementations on Foreign Types

Implementors