Trait type_equalities::Consumer [−][src]
pub trait Consumer<T: ?Sized, U: ?Sized> { type Result; fn consume_eq(self) -> Self::Result
where
T: IsEqual<U>; }
A consumer recives evidence of a type equality T == U and computes a result.
Associated Types
type Result[src]
The result type returned from Consumer::consume_eq.
Required methods
fn consume_eq(self) -> Self::Result where
T: IsEqual<U>, [src]
T: IsEqual<U>,
The strange where clause enables the consumer to observe that:
T == <T as AssocSelf>::Aliasby the implementation ofAssocSelfT::Alias == U
Directly writing T = U is currently not possible, as tracked by issue #20041.
A workaround, to make it easier for implementors to construct your own Consumer
is, if your consumer takes a generic parameter T, store of values with type
<T as AliasSelf>::Alias internally. In consume_eq, the compiler will correctly
reduce this to U, since it sees the where clause. Additionally, during
construction (somewhere else), the compiler sees the impl<T> for AssocSelf,
correctly using the first equality. Thus, you don’t have to coerce consumers.