pub trait TypeRelation<I: Interner>: Sized {
// Required methods
fn cx(&self) -> I;
fn relate_ty_args(
&mut self,
a_ty: I::Ty,
b_ty: I::Ty,
ty_def_id: I::DefId,
a_arg: I::GenericArgs,
b_arg: I::GenericArgs,
mk: impl FnOnce(I::GenericArgs) -> I::Ty,
) -> RelateResult<I, I::Ty>;
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 method
fn relate<T: Relate<I>>(&mut self, a: T, b: T) -> RelateResult<I, T> { ... }
}Required Methods§
fn cx(&self) -> I
fn relate_ty_args( &mut self, a_ty: I::Ty, b_ty: I::Ty, ty_def_id: I::DefId, a_arg: I::GenericArgs, b_arg: I::GenericArgs, mk: impl FnOnce(I::GenericArgs) -> I::Ty, ) -> RelateResult<I, I::Ty>
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.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".