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

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

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

type Result[src]

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

Loading content...

Required methods

pub fn fold_with<'i>(
    &self,
    folder: &mut dyn Folder<'i, I>,
    outer_binder: DebruijnIndex
) -> Fallible<Self::Result> where
    I: 'i, 
[src]

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.

Loading content...

Implementations on Foreign Types

impl<'a, T: Fold<I>, I: Interner> Fold<I> for &'a T[src]

type Result = T::Result

impl<T: Fold<I>, I: Interner> Fold<I> for Vec<T>[src]

type Result = Vec<T::Result>

impl<T: Fold<I>, I: Interner> Fold<I> for Box<T>[src]

type Result = Box<T::Result>

impl<T: Fold<I>, I: Interner> Fold<I> for Arc<T>[src]

type Result = Arc<T::Result>

impl<A: Fold<I>, B: Fold<I>, I: Interner> Fold<I> for (A, B)[src]

type Result = (A::Result, B::Result)

impl<A: Fold<I>, B: Fold<I>, C: Fold<I>, I: Interner> Fold<I> for (A, B, C)[src]

type Result = (A::Result, B::Result, C::Result)

impl<A: Fold<I>, B: Fold<I>, C: Fold<I>, D: Fold<I>, I: Interner> Fold<I> for (A, B, C, D)[src]

type Result = (A::Result, B::Result, C::Result, D::Result)

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)[src]

type Result = (A::Result, B::Result, C::Result, D::Result, E::Result)

impl<T: Fold<I>, I: Interner> Fold<I> for Option<T>[src]

type Result = Option<T::Result>

impl<I: Interner> Fold<I> for bool[src]

type Result = Self

impl<I: Interner> Fold<I> for usize[src]

type Result = Self

impl<I: Interner> Fold<I> for ()[src]

type Result = Self

impl<I: Interner> Fold<I> for PhantomData<I>[src]

type Result = PhantomData<I>

Loading content...

Implementors

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>, 
[src]

type Result = InEnvironment<_U>

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>, 
[src]

type Result = Canonical<T::Result>

impl<I: Interner> Fold<I> for AliasTy<I>[src]

type Result = AliasTy<I>

impl<I: Interner> Fold<I> for ClausePriority[src]

type Result = Self

impl<I: Interner> Fold<I> for Constraint<I>[src]

type Result = Constraint<I>

impl<I: Interner> Fold<I> for DomainGoal<I>[src]

type Result = DomainGoal<I>

impl<I: Interner> Fold<I> for FloatTy[src]

type Result = Self

impl<I: Interner> Fold<I> for FromEnv<I>[src]

type Result = FromEnv<I>

impl<I: Interner> Fold<I> for GenericArgData<I>[src]

type Result = GenericArgData<I>

impl<I: Interner> Fold<I> for GoalData<I>[src]

type Result = GoalData<I>

impl<I: Interner> Fold<I> for IntTy[src]

type Result = Self

impl<I: Interner> Fold<I> for Mutability[src]

type Result = Self

impl<I: Interner> Fold<I> for QuantifierKind[src]

type Result = Self

impl<I: Interner> Fold<I> for Safety[src]

type Result = Self

impl<I: Interner> Fold<I> for Scalar[src]

type Result = Self

impl<I: Interner> Fold<I> for UintTy[src]

type Result = Self

impl<I: Interner> Fold<I> for WellFormed<I>[src]

type Result = WellFormed<I>

impl<I: Interner> Fold<I> for WhereClause<I>[src]

type Result = WhereClause<I>

impl<I: Interner> Fold<I> for AdtId<I>[src]

type Result = AdtId<I>

impl<I: Interner> Fold<I> for AliasEq<I>[src]

type Result = AliasEq<I>

impl<I: Interner> Fold<I> for AnswerSubst<I>[src]

type Result = AnswerSubst<I>

impl<I: Interner> Fold<I> for AssocTypeId<I>[src]

type Result = AssocTypeId<I>

impl<I: Interner> Fold<I> for ClosureId<I>[src]

type Result = ClosureId<I>

impl<I: Interner> Fold<I> for Const<I>[src]

"Folding" a const invokes the fold_const method on the folder; this usually (in turn) invokes super_fold_const to fold the individual parts.

type Result = Const<I>

impl<I: Interner> Fold<I> for ConstrainedSubst<I>[src]

type Result = ConstrainedSubst<I>

impl<I: Interner> Fold<I> for Constraints<I>[src]

type Result = Constraints<I>

impl<I: Interner> Fold<I> for DebruijnIndex[src]

type Result = Self

impl<I: Interner> Fold<I> for DynTy<I>[src]

type Result = DynTy<I>

impl<I: Interner> Fold<I> for Environment<I>[src]

type Result = Environment<I>

impl<I: Interner> Fold<I> for EqGoal<I>[src]

type Result = EqGoal<I>

impl<I: Interner> Fold<I> for FnDefId<I>[src]

type Result = FnDefId<I>

impl<I: Interner> Fold<I> for FnPointer<I>[src]

type Result = FnPointer<I>

impl<I: Interner> Fold<I> for FnSubst<I>[src]

type Result = FnSubst<I>

impl<I: Interner> Fold<I> for ForeignDefId<I>[src]

type Result = ForeignDefId<I>

impl<I: Interner> Fold<I> for GeneratorId<I>[src]

type Result = GeneratorId<I>

impl<I: Interner> Fold<I> for GenericArg<I>[src]

type Result = GenericArg<I>

impl<I: Interner> Fold<I> for Goal<I>[src]

Folding a goal invokes the fold_goal callback (which will, by default, invoke super-fold).

type Result = Goal<I>

impl<I: Interner> Fold<I> for Goals<I>[src]

type Result = Goals<I>

impl<I: Interner> Fold<I> for ImplId<I>[src]

type Result = ImplId<I>

impl<I: Interner> Fold<I> for Lifetime<I>[src]

"Folding" a lifetime invokes the fold_lifetime method on the folder; this usually (in turn) invokes super_fold_lifetime to fold the individual parts.

type Result = Lifetime<I>

impl<I: Interner> Fold<I> for LifetimeOutlives<I>[src]

type Result = LifetimeOutlives<I>

impl<I: Interner> Fold<I> for Normalize<I>[src]

type Result = Normalize<I>

impl<I: Interner> Fold<I> for OpaqueTy<I>[src]

type Result = OpaqueTy<I>

impl<I: Interner> Fold<I> for OpaqueTyId<I>[src]

type Result = OpaqueTyId<I>

impl<I: Interner> Fold<I> for PlaceholderIndex[src]

type Result = Self

impl<I: Interner> Fold<I> for ProgramClause<I>[src]

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>

impl<I: Interner> Fold<I> for ProgramClauseData<I>[src]

type Result = ProgramClauseData<I>

impl<I: Interner> Fold<I> for ProgramClauseImplication<I>[src]

type Result = ProgramClauseImplication<I>

impl<I: Interner> Fold<I> for ProgramClauses<I>[src]

type Result = ProgramClauses<I>

impl<I: Interner> Fold<I> for ProjectionTy<I>[src]

type Result = ProjectionTy<I>

impl<I: Interner> Fold<I> for QuantifiedWhereClauses<I>[src]

type Result = QuantifiedWhereClauses<I>

impl<I: Interner> Fold<I> for Substitution<I>[src]

type Result = Substitution<I>

impl<I: Interner> Fold<I> for SubtypeGoal<I>[src]

type Result = SubtypeGoal<I>

impl<I: Interner> Fold<I> for TraitId<I>[src]

type Result = TraitId<I>

impl<I: Interner> Fold<I> for TraitRef<I>[src]

type Result = TraitRef<I>

impl<I: Interner> Fold<I> for Ty<I>[src]

"Folding" a type invokes the fold_ty method on the folder; this usually (in turn) invokes super_fold_ty to fold the individual parts.

type Result = Ty<I>

impl<I: Interner> Fold<I> for TypeOutlives<I>[src]

type Result = TypeOutlives<I>

impl<I: Interner> Fold<I> for UniverseIndex[src]

type Result = Self

impl<T, I: Interner> Fold<I> for Binders<T> where
    T: HasInterner<Interner = I> + Fold<I>,
    <T as Fold<I>>::Result: HasInterner<Interner = I>,
    I: Interner
[src]

type Result = Binders<T::Result>

Loading content...