[−][src]Trait chalk_ir::zip::Zipper
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
fn zip_tys(&mut self, a: &Ty<I>, b: &Ty<I>) -> Fallible<()>
Indicates that the two types a
and b
were found in matching spots.
fn zip_lifetimes(&mut self, a: &Lifetime<I>, b: &Lifetime<I>) -> Fallible<()>
Indicates that the two lifetimes a
and b
were found in matching spots.
fn zip_consts(&mut self, a: &Const<I>, b: &Const<I>) -> Fallible<()>
Indicates that the two consts a
and b
were found in matching spots.
fn zip_binders<T>(&mut self, a: &Binders<T>, b: &Binders<T>) -> Fallible<()> where
T: HasInterner<Interner = I> + Zip<I> + Fold<I, I, Result = T>,
T: HasInterner<Interner = I> + Zip<I> + Fold<I, I, Result = T>,
Zips two values appearing beneath binders.
fn interner(&self) -> &'i I
Retreives the interner from the underlying zipper object
Implementations on Foreign Types
impl<'f, 'i, Z, I> Zipper<'i, I> for &'f mut Z where
I: Interner,
Z: Zipper<'i, I>,
[src]
I: Interner,
Z: Zipper<'i, I>,
fn zip_tys(&mut self, a: &Ty<I>, b: &Ty<I>) -> Fallible<()>
[src]
fn zip_lifetimes(&mut self, a: &Lifetime<I>, b: &Lifetime<I>) -> Fallible<()>
[src]
fn zip_consts(&mut self, a: &Const<I>, b: &Const<I>) -> Fallible<()>
[src]
fn zip_binders<T>(&mut self, a: &Binders<T>, b: &Binders<T>) -> Fallible<()> where
T: HasInterner<Interner = I> + Zip<I> + Fold<I, I, Result = T>,
[src]
T: HasInterner<Interner = I> + Zip<I> + Fold<I, I, Result = T>,