Trait HasTempRepr

Source
pub trait HasTempRepr {
    type Temp: TempRepr;
    type Shared<'a>
       where Self: 'a;

    // Required methods
    fn shared_to_mapped(
        obj: Self::Shared<'_>,
    ) -> <Self::Temp as TempRepr>::Shared<'_>;
    fn mapped_to_shared(
        mapped: <Self::Temp as TempRepr>::Shared<'_>,
    ) -> Self::Shared<'_>;
}
Expand description

A safe helper trait for implementing the unsafe TempRepr and TempReprMut traits for a type, by mapping between the type and one with a temporary representation.

The trait must be implemented on some arbitrary type T; by convention this should be the same as Self::Mutable<'static>. Then MappedTempRepr<T> can be used as the argument of TempInst.

Required Associated Types§

Source

type Temp: TempRepr

Source

type Shared<'a> where Self: 'a

Required Methods§

Source

fn shared_to_mapped( obj: Self::Shared<'_>, ) -> <Self::Temp as TempRepr>::Shared<'_>

Source

fn mapped_to_shared( mapped: <Self::Temp as TempRepr>::Shared<'_>, ) -> Self::Shared<'_>

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl HasTempRepr for Chars<'static>

Source§

type Temp = TempRef<str>

Source§

type Shared<'a> = Chars<'a> where Self: 'a

Source§

fn shared_to_mapped( obj: Self::Shared<'_>, ) -> <Self::Temp as TempRepr>::Shared<'_>

Source§

fn mapped_to_shared( mapped: <Self::Temp as TempRepr>::Shared<'_>, ) -> Self::Shared<'_>

Source§

impl<T> HasTempRepr for Iter<'static, T>

Source§

type Temp = TempRef<[T]>

Source§

type Shared<'a> = Iter<'a, T> where Self: 'a

Source§

fn shared_to_mapped( obj: Self::Shared<'_>, ) -> <Self::Temp as TempRepr>::Shared<'_>

Source§

fn mapped_to_shared( mapped: <Self::Temp as TempRepr>::Shared<'_>, ) -> Self::Shared<'_>

Source§

impl<T> HasTempRepr for IterMut<'static, T>

Source§

type Temp = TempRefMut<[T]>

Source§

type Shared<'a> = Iter<'a, T> where Self: 'a

Source§

fn shared_to_mapped( obj: Self::Shared<'_>, ) -> <Self::Temp as TempRepr>::Shared<'_>

Source§

fn mapped_to_shared( mapped: <Self::Temp as TempRepr>::Shared<'_>, ) -> Self::Shared<'_>

Implementors§