Struct type_equalities::TypeEq[][src]

pub struct TypeEq<T: ?Sized, U: ?Sized> { /* fields omitted */ }

Evidence of the equality T == U as a zero-sized type.

assert_eq!(core::mem::size_of::<TypeEq<T, U>>(), 0);

Implementations

impl<T: ?Sized> TypeEq<T, T>[src]

pub fn refl() -> TypeEq<T, T>[src]

Same as crate::refl.

impl<T: ?Sized, U: ?Sized> TypeEq<T, U>[src]

pub fn trivial() -> Self where
    T: IsEqual<U>, 
[src]

pub fn substitute<F: TypeFunction<T> + TypeFunction<U>>(
    self,
    t: ApF<F, T>
) -> ApF<F, U> where
    ApF<F, T>: Sized,
    ApF<F, U>: Sized
[src]

pub fn coerce(self, t: T) -> U where
    T: Sized,
    U: Sized
[src]

Same as crate::coerce. Note that this is operationally a no-op.

Examples

assert_eq!(refl().coerce(42), 42);

pub fn lift_through<F: TypeFunction<T> + TypeFunction<U>>(
    self
) -> TypeEq<ApF<F, T>, ApF<F, U>>
[src]

Lift the type equality through any TypeFunction

pub fn invert(self) -> TypeEq<U, T>[src]

Get the inverse equality. T == U ==> U == T

pub fn trans<V: ?Sized>(self, rhs: TypeEq<U, V>) -> TypeEq<T, V>[src]

Apply transitivity. T == U ==> U == V ==> T == V

impl<T: ?Sized, U: ?Sized> TypeEq<T, U>[src]

pub fn use_eq<C: Consumer<T, U>>(self, c: C) -> C::Result[src]

Use the observed equality to call the consumer to compute a result.

Consider using once of TypeEq::coerce or TypeEq::lift_through first.

Trait Implementations

impl<T: ?Sized, U: ?Sized> Clone for TypeEq<T, U>[src]

fn clone(&self) -> Self[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<T: ?Sized, U: ?Sized> Copy for TypeEq<T, U>[src]

Auto Trait Implementations

impl<T, U> !Send for TypeEq<T, U>

impl<T, U> !Sync for TypeEq<T, U>

impl<T: ?Sized, U: ?Sized> Unpin for TypeEq<T, U>

Blanket Implementations

impl<T> AliasSelf for T where
    T: ?Sized
[src]

type Alias = T

Always set to Self, but the type checker doesn’t reduce T::Alias to T.

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<T, U> IsEqual<U> for T where
    T: AliasSelf<Alias = U> + ?Sized,
    U: ?Sized
[src]