[][src]Trait metatype::Type

pub trait Type {
    type Meta: 'static;

    const METATYPE: MetaType;

    fn meta(&self) -> Self::Meta;
fn data(&self) -> *const ();
fn data_mut(&mut self) -> *mut ();
unsafe fn uninitialized_box(t: Self::Meta) -> Box<Self>; fn meta_type(&self) -> MetaType { ... } }

Implemented on all types, it provides helper methods to determine whether a type is TraitObject, Slice or Concrete, and work with them respectively.

Associated Types

type Meta: 'static

Type of metadata for type.

Loading content...

Associated Constants

const METATYPE: MetaType

Enum describing whether a type is TraitObject, Slice or Concrete.

Loading content...

Required methods

fn meta(&self) -> Self::Meta

Retrieve TraitObject, Slice or Concrete meta data respectively for a type

fn data(&self) -> *const ()

Retrieve pointer to the data

fn data_mut(&mut self) -> *mut ()

Retrieve mut pointer to the data

unsafe fn uninitialized_box(t: Self::Meta) -> Box<Self>

Create a Box<Self> with the provided Self::Meta but with the allocated data uninitialized.

See the ongoing discussion Validity of Box<T> for validity.

Loading content...

Provided methods

fn meta_type(&self) -> MetaType

Helper method describing whether a type is TraitObject, Slice or Concrete.

Loading content...

Implementors

impl<T: ?Sized> Type for T[src]

Loading content...