pub trait TypeRelation<I: Interner>: Sized {
// Required methods
fn cx(&self) -> I;
fn relate_with_variance<T: Relate<I>>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<I>,
a: T,
b: T,
) -> RelateResult<I, T>;
fn tys(&mut self, a: I::Ty, b: I::Ty) -> RelateResult<I, I::Ty>;
fn regions(
&mut self,
a: I::Region,
b: I::Region,
) -> RelateResult<I, I::Region>;
fn consts(&mut self, a: I::Const, b: I::Const) -> RelateResult<I, I::Const>;
fn binders<T>(
&mut self,
a: Binder<I, T>,
b: Binder<I, T>,
) -> RelateResult<I, Binder<I, T>>
where T: Relate<I>;
// Provided methods
fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T> { ... }
fn relate_item_args(
&mut self,
item_def_id: I::DefId,
a_arg: I::GenericArgs,
b_arg: I::GenericArgs,
) -> RelateResult<I, I::GenericArgs> { ... }
}
Required Methods§
fn cx(&self) -> I
Sourcefn relate_with_variance<T: Relate<I>>(
&mut self,
variance: Variance,
info: VarianceDiagInfo<I>,
a: T,
b: T,
) -> RelateResult<I, T>
fn relate_with_variance<T: Relate<I>>( &mut self, variance: Variance, info: VarianceDiagInfo<I>, a: T, b: T, ) -> RelateResult<I, T>
Switch variance for the purpose of relating a
and b
.
fn tys(&mut self, a: I::Ty, b: I::Ty) -> RelateResult<I, I::Ty>
fn regions(&mut self, a: I::Region, b: I::Region) -> RelateResult<I, I::Region>
fn consts(&mut self, a: I::Const, b: I::Const) -> RelateResult<I, I::Const>
fn binders<T>(
&mut self,
a: Binder<I, T>,
b: Binder<I, T>,
) -> RelateResult<I, Binder<I, T>>where
T: Relate<I>,
Provided Methods§
Sourcefn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T>
fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T>
Generic relation routine suitable for most anything.
Sourcefn relate_item_args(
&mut self,
item_def_id: I::DefId,
a_arg: I::GenericArgs,
b_arg: I::GenericArgs,
) -> RelateResult<I, I::GenericArgs>
fn relate_item_args( &mut self, item_def_id: I::DefId, a_arg: I::GenericArgs, b_arg: I::GenericArgs, ) -> RelateResult<I, I::GenericArgs>
Relate the two args for the given item. The default is to look up the variance for the item and proceed accordingly.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.