pub trait Fold<I: Interner>: Debug {
type Result;
fn fold_with<E>(
self,
folder: &mut dyn Folder<I, Error = E>,
outer_binder: DebruijnIndex
) -> Result<Self::Result, E>;
}
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.
Implementations on Foreign Types
sourceimpl<A: Fold<I>, B: Fold<I>, C: Fold<I>, D: Fold<I>, E: Fold<I>, I: Interner> Fold<I> for (A, B, C, D, E)
impl<A: Fold<I>, B: Fold<I>, C: Fold<I>, D: Fold<I>, E: Fold<I>, I: Interner> Fold<I> for (A, B, C, D, E)
sourceimpl<I: Interner> Fold<I> for PhantomData<I>
impl<I: Interner> Fold<I> for PhantomData<I>
type Result = PhantomData<I>
fn fold_with<E>(
self,
_folder: &mut dyn Folder<I, Error = E>,
_outer_binder: DebruijnIndex
) -> Result<Self::Result, E>
Implementors
sourceimpl<G: HasInterner, _I, _U> Fold<_I> for InEnvironment<G> where
_I: Interner,
G: HasInterner<Interner = _I>,
G: Fold<_I, Result = _U>,
_U: HasInterner<Interner = _I>,
impl<G: HasInterner, _I, _U> Fold<_I> for InEnvironment<G> where
_I: Interner,
G: HasInterner<Interner = _I>,
G: Fold<_I, Result = _U>,
_U: HasInterner<Interner = _I>,
type Result = InEnvironment<_U>
sourceimpl<I, T> Fold<I> for Canonical<T> where
I: Interner,
T: HasInterner<Interner = I> + Fold<I>,
<T as Fold<I>>::Result: HasInterner<Interner = I>,
impl<I, T> Fold<I> for Canonical<T> where
I: Interner,
T: HasInterner<Interner = I> + Fold<I>,
<T as Fold<I>>::Result: HasInterner<Interner = I>,
sourceimpl<I: Interner> Fold<I> for ClausePriority
impl<I: Interner> Fold<I> for ClausePriority
type Result = Self
sourceimpl<I: Interner> Fold<I> for Constraint<I>
impl<I: Interner> Fold<I> for Constraint<I>
type Result = Constraint<I>
sourceimpl<I: Interner> Fold<I> for DomainGoal<I>
impl<I: Interner> Fold<I> for DomainGoal<I>
type Result = DomainGoal<I>
sourceimpl<I: Interner> Fold<I> for GenericArgData<I>
impl<I: Interner> Fold<I> for GenericArgData<I>
type Result = GenericArgData<I>
sourceimpl<I: Interner> Fold<I> for Mutability
impl<I: Interner> Fold<I> for Mutability
type Result = Self
sourceimpl<I: Interner> Fold<I> for QuantifierKind
impl<I: Interner> Fold<I> for QuantifierKind
type Result = Self
sourceimpl<I: Interner> Fold<I> for WellFormed<I>
impl<I: Interner> Fold<I> for WellFormed<I>
type Result = WellFormed<I>
sourceimpl<I: Interner> Fold<I> for WhereClause<I>
impl<I: Interner> Fold<I> for WhereClause<I>
type Result = WhereClause<I>
sourceimpl<I: Interner> Fold<I> for AnswerSubst<I>
impl<I: Interner> Fold<I> for AnswerSubst<I>
type Result = AnswerSubst<I>
sourceimpl<I: Interner> Fold<I> for AssocTypeId<I>
impl<I: Interner> Fold<I> for AssocTypeId<I>
type Result = AssocTypeId<I>
sourceimpl<I: Interner> Fold<I> for Const<I>
impl<I: Interner> Fold<I> for Const<I>
“Folding” a const invokes the fold_const
method on the folder; this
usually (in turn) invokes super_fold_const
to fold the individual
parts.
sourceimpl<I: Interner> Fold<I> for ConstrainedSubst<I>
impl<I: Interner> Fold<I> for ConstrainedSubst<I>
type Result = ConstrainedSubst<I>
sourceimpl<I: Interner> Fold<I> for Constraints<I>
impl<I: Interner> Fold<I> for Constraints<I>
type Result = Constraints<I>
sourceimpl<I: Interner> Fold<I> for DebruijnIndex
impl<I: Interner> Fold<I> for DebruijnIndex
type Result = Self
sourceimpl<I: Interner> Fold<I> for Environment<I>
impl<I: Interner> Fold<I> for Environment<I>
type Result = Environment<I>
sourceimpl<I: Interner> Fold<I> for ForeignDefId<I>
impl<I: Interner> Fold<I> for ForeignDefId<I>
type Result = ForeignDefId<I>
sourceimpl<I: Interner> Fold<I> for GeneratorId<I>
impl<I: Interner> Fold<I> for GeneratorId<I>
type Result = GeneratorId<I>
sourceimpl<I: Interner> Fold<I> for GenericArg<I>
impl<I: Interner> Fold<I> for GenericArg<I>
type Result = GenericArg<I>
sourceimpl<I: Interner> Fold<I> for Goal<I>
impl<I: Interner> Fold<I> for Goal<I>
Folding a goal invokes the fold_goal
callback (which will, by
default, invoke super-fold).
sourceimpl<I: Interner> Fold<I> for Lifetime<I>
impl<I: Interner> Fold<I> for Lifetime<I>
“Folding” a lifetime invokes the fold_lifetime
method on the folder; this
usually (in turn) invokes super_fold_lifetime
to fold the individual
parts.
sourceimpl<I: Interner> Fold<I> for LifetimeOutlives<I>
impl<I: Interner> Fold<I> for LifetimeOutlives<I>
type Result = LifetimeOutlives<I>
sourceimpl<I: Interner> Fold<I> for OpaqueTyId<I>
impl<I: Interner> Fold<I> for OpaqueTyId<I>
type Result = OpaqueTyId<I>
sourceimpl<I: Interner> Fold<I> for PlaceholderIndex
impl<I: Interner> Fold<I> for PlaceholderIndex
type Result = Self
sourceimpl<I: Interner> Fold<I> for ProgramClause<I>
impl<I: Interner> Fold<I> for ProgramClause<I>
Folding a program clause invokes the fold_program_clause
callback on the folder (which will, by default, invoke the
super_fold_with
method on the program clause).
type Result = ProgramClause<I>
sourceimpl<I: Interner> Fold<I> for ProgramClauseData<I>
impl<I: Interner> Fold<I> for ProgramClauseData<I>
type Result = ProgramClauseData<I>
sourceimpl<I: Interner> Fold<I> for ProgramClauseImplication<I>
impl<I: Interner> Fold<I> for ProgramClauseImplication<I>
type Result = ProgramClauseImplication<I>
sourceimpl<I: Interner> Fold<I> for ProgramClauses<I>
impl<I: Interner> Fold<I> for ProgramClauses<I>
type Result = ProgramClauses<I>
sourceimpl<I: Interner> Fold<I> for ProjectionTy<I>
impl<I: Interner> Fold<I> for ProjectionTy<I>
type Result = ProjectionTy<I>
sourceimpl<I: Interner> Fold<I> for QuantifiedWhereClauses<I>
impl<I: Interner> Fold<I> for QuantifiedWhereClauses<I>
type Result = QuantifiedWhereClauses<I>
sourceimpl<I: Interner> Fold<I> for Substitution<I>
impl<I: Interner> Fold<I> for Substitution<I>
type Result = Substitution<I>
sourceimpl<I: Interner> Fold<I> for SubtypeGoal<I>
impl<I: Interner> Fold<I> for SubtypeGoal<I>
type Result = SubtypeGoal<I>
sourceimpl<I: Interner> Fold<I> for Ty<I>
impl<I: Interner> Fold<I> for Ty<I>
“Folding” a type invokes the fold_ty
method on the folder; this
usually (in turn) invokes super_fold_ty
to fold the individual
parts.