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