[][src]Trait rel_ptr::MetaData

pub unsafe trait MetaData {
    type Data: Default + Copy + Eq;
    fn decompose(this: &Self) -> (*const u8, Self::Data);
unsafe fn compose(ptr: *const u8, data: Self::Data) -> *mut Self; }

A trait to abstract over the sizedness of types, and to access metadata about a type

If Custom DST lands and stablizes, then it will replace MetaData

Associated Types

type Data: Default + Copy + Eq

the type of meta data a type carries

Loading content...

Required methods

fn decompose(this: &Self) -> (*const u8, Self::Data)

decompose a type into a thin pointer and some metadata

unsafe fn compose(ptr: *const u8, data: Self::Data) -> *mut Self

recompose a type from a thin pointer and some metadata

it is guarenteed that the metadata is

  • MetaData::Data::default() if ptr == null
  • generated from MetaData::decompose
Loading content...

Implementations on Foreign Types

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

type Data = usize

impl MetaData for str[src]

type Data = usize

Loading content...

Implementors

impl<T> MetaData for T[src]

type Data = ()

Loading content...