Trait escher::RebindTo[][src]

pub unsafe trait RebindTo<'a> {
    type Out: 'a;
}

The RebindTo trait defines a type level function that allows you convert a type that holds references of lifetime 'a to a type that holds references of lifetime 'b.

The trait is unsafe because the implementer needs to make sure that the associated type differs with the implementing type only on their lifetimes. In other words, it’s meant to prevent incantations like:

unsafe impl<'a> RebindTo<'a> for Foo<'_> {
    type Out = Bar<'a>; // !!WRONG!!
}

unsafe impl<'a> RebindTo<'a> for Foo<'_> {
    type Out = Foo<'a>; // CORRECT
}

Users should avoid implementing this trait manually and derive Rebindable instead.

Associated Types

type Out: 'a[src]

Loading content...

Implementations on Foreign Types

impl<'a, T: ?Sized + 'static> RebindTo<'a> for &T[src]

Blanket implementation for any reference to owned data

type Out = &'a T

impl<'a, T: ?Sized + 'static> RebindTo<'a> for &mut T[src]

Blanket implementation for any mutable reference to owned data

type Out = &'a mut T

Loading content...

Implementors

Loading content...