Trait identity::Identity [] [src]

pub trait Identity<A: ?Sized, B: ?Sized>: IdentityAux<A, B> {
    fn conv(&self, x: A) -> B where A: Sized, B: Sized;
    fn conv_ref<'a>(&self, x: &'a A) -> &'a B;
    fn conv_mut<'a>(&self, x: &'a mut A) -> &'a mut B;
    fn conv_box(&self, x: Box<A>) -> Box<B>;
    fn conv_gen<Tc: HasParam<A, B>>(&self, x: Tc) -> Tc::SubstParam where Tc::SubstParam: Sized;
    fn inv(&self) -> &Self::Inverse;
}

An identity type; that is, the type of “equality witnesses.”

This trait is not actually extensible; it relies on a hidden auxiliary trait to operate properly while maintaining its invariants. It should instead be thought of as a semi-magical bound that all concrete equality witness types satisfy.

Required Methods

fn conv(&self, x: A) -> B where A: Sized, B: Sized

fn conv_ref<'a>(&self, x: &'a A) -> &'a B

fn conv_mut<'a>(&self, x: &'a mut A) -> &'a mut B

fn conv_box(&self, x: Box<A>) -> Box<B>

fn conv_gen<Tc: HasParam<A, B>>(&self, x: Tc) -> Tc::SubstParam where Tc::SubstParam: Sized

fn inv(&self) -> &Self::Inverse

Implementors