[][src]Trait chalk_ir::zip::Zipper

pub trait Zipper<'i, I: Interner + 'i> {
    pub fn zip_tys(
        &mut self,
        variance: Variance,
        a: &Ty<I>,
        b: &Ty<I>
    ) -> Fallible<()>;
pub fn zip_lifetimes(
        &mut self,
        variance: Variance,
        a: &Lifetime<I>,
        b: &Lifetime<I>
    ) -> Fallible<()>;
pub fn zip_consts(
        &mut self,
        variance: Variance,
        a: &Const<I>,
        b: &Const<I>
    ) -> Fallible<()>;
pub fn zip_binders<T>(
        &mut self,
        variance: Variance,
        a: &Binders<T>,
        b: &Binders<T>
    ) -> Fallible<()>
    where
        T: HasInterner<Interner = I> + Zip<I> + Fold<I, Result = T>
;
pub fn interner(&self) -> &'i I;
pub fn unification_database(&self) -> &dyn UnificationDatabase<I>; pub fn zip_substs(
        &mut self,
        ambient: Variance,
        variances: Option<Variances<I>>,
        a: &[GenericArg<I>],
        b: &[GenericArg<I>]
    ) -> Fallible<()>
    where
        Self: Sized
, { ... } }

When we zip types, we basically traverse the structure, ensuring that it matches. When we come to types/lifetimes, we invoke the callback methods in the zipper to match them up. Primarily used during unification or similar operations.

So e.g. if you had A: Eq<B> zipped with X: Eq<Y>, then the zipper would get two callbacks, one pairing A and X, and the other pairing B and Y.

For things other than types/lifetimes, the zip impls will guarantee equality. So e.g. if you have A: Eq<B> zipped with X: Ord<Y>, you would wind up with an error, no matter what zipper you are using. This is because the traits Eq and Ord are represented by two distinct ItemId values, and the impl for ItemId requires that all ItemId in the two zipped values match up.

Required methods

pub fn zip_tys(
    &mut self,
    variance: Variance,
    a: &Ty<I>,
    b: &Ty<I>
) -> Fallible<()>
[src]

Indicates that the two types a and b were found in matching spots.

pub fn zip_lifetimes(
    &mut self,
    variance: Variance,
    a: &Lifetime<I>,
    b: &Lifetime<I>
) -> Fallible<()>
[src]

Indicates that the two lifetimes a and b were found in matching spots.

pub fn zip_consts(
    &mut self,
    variance: Variance,
    a: &Const<I>,
    b: &Const<I>
) -> Fallible<()>
[src]

Indicates that the two consts a and b were found in matching spots.

pub fn zip_binders<T>(
    &mut self,
    variance: Variance,
    a: &Binders<T>,
    b: &Binders<T>
) -> Fallible<()> where
    T: HasInterner<Interner = I> + Zip<I> + Fold<I, Result = T>, 
[src]

Zips two values appearing beneath binders.

pub fn interner(&self) -> &'i I[src]

Retrieves the interner from the underlying zipper object

pub fn unification_database(&self) -> &dyn UnificationDatabase<I>[src]

Retrieves the UnificationDatabase from the underlying zipper object

Loading content...

Provided methods

pub fn zip_substs(
    &mut self,
    ambient: Variance,
    variances: Option<Variances<I>>,
    a: &[GenericArg<I>],
    b: &[GenericArg<I>]
) -> Fallible<()> where
    Self: Sized
[src]

Zips two substs

Loading content...

Implementations on Foreign Types

impl<'f, 'i, Z, I> Zipper<'i, I> for &'f mut Z where
    I: Interner + 'i,
    Z: Zipper<'i, I>, 
[src]

Loading content...

Implementors

Loading content...