[][src]Struct chalk_ir::fold::Subst

pub struct Subst<'s, 'i, I: Interner> { /* fields omitted */ }

Substitution used during folding

Implementations

impl<I: Interner, '_, '_> Subst<'_, '_, I>[src]

pub fn apply<T: Fold<I, I>>(
    interner: &I,
    parameters: &[GenericArg<I>],
    value: &T
) -> T::Result
[src]

Applies the substitution by folding

Trait Implementations

impl<'i, I: Interner, '_> Folder<'i, I, I> for Subst<'_, 'i, I>[src]

fn fold_free_var_ty(
    &mut self,
    bound_var: BoundVar,
    outer_binder: DebruijnIndex
) -> Fallible<Ty<I>>
[src]

We are eliminating one binder, but binders outside of that get preserved.

So e.g. consider this:

for<A, B> { for<C> { [A, C] } }
//          ^ the binder we are substituing with `[u32]`

Here, A would be ^1.0 and C would be ^0.0. We will replace ^0.0 with the 0th index from the list (u32). We will convert ^1.0 (A) to ^0.0 -- i.e., shift it out of one level of binder (the for<C> binder we are eliminating).

This gives us as a result:

for<A, B> { [A, u32] }
             ^ represented as `^0.0`

fn fold_free_var_lifetime(
    &mut self,
    bound_var: BoundVar,
    outer_binder: DebruijnIndex
) -> Fallible<Lifetime<I>>
[src]

see fold_free_var_ty

fn fold_free_var_const(
    &mut self,
    ty: &Ty<I>,
    bound_var: BoundVar,
    outer_binder: DebruijnIndex
) -> Fallible<Const<I>>
[src]

see fold_free_var_ty

Auto Trait Implementations

impl<'s, 'i, I> RefUnwindSafe for Subst<'s, 'i, I> where
    I: RefUnwindSafe,
    <I as Interner>::InternedGenericArg: RefUnwindSafe

impl<'s, 'i, I> Send for Subst<'s, 'i, I> where
    I: Sync,
    <I as Interner>::InternedGenericArg: Sync

impl<'s, 'i, I> Sync for Subst<'s, 'i, I> where
    I: Sync,
    <I as Interner>::InternedGenericArg: Sync

impl<'s, 'i, I> Unpin for Subst<'s, 'i, I>

impl<'s, 'i, I> UnwindSafe for Subst<'s, 'i, I> where
    I: RefUnwindSafe,
    <I as Interner>::InternedGenericArg: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Cast for T[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.