Vtable

Trait Vtable 

Source
pub unsafe trait Vtable<T>: DynTrait {
    const DROP_IN_PLACE_FN: Option<unsafe fn(NonNull<()>)> = _;

    // Required method
    fn vtable<S: Storage>() -> &'static Self::Vtable;
}
Expand description

A vtable constructor.

§Safety

  • DynTrait::layout must return core::alloc::Layout::new::<T>().
  • DynTrait::drop_in_place_fn must returns <Self as crate::object::Vtable<T>>::DROP_IN_PLACE_FN

Provided Associated Constants§

Source

const DROP_IN_PLACE_FN: Option<unsafe fn(NonNull<()>)> = _

The function has the same safety contract that core::ptr::drop_in_place.

Required Methods§

Source

fn vtable<S: Storage>() -> &'static Self::Vtable

Returns the vtable for a given T stored in S.

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<'__lt, __TypeItem, __Dyn: Iterator<Item = __TypeItem> + '__lt> Vtable<__Dyn> for dyn Iterator<Item = __TypeItem> + '__lt

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Source§

impl<'__lt, __TypeOutput, __Dyn: Future<Output = __TypeOutput> + '__lt + Send> Vtable<__Dyn> for dyn Future<Output = __TypeOutput> + Send + '__lt

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Source§

impl<'__lt, __TypeOutput, __Dyn: Future<Output = __TypeOutput> + '__lt> Vtable<__Dyn> for dyn Future<Output = __TypeOutput> + '__lt

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Source§

impl<__Dyn: Any> Vtable<__Dyn> for dyn Any

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Source§

impl<__Dyn: Any> Vtable<__Dyn> for dyn Any + Send

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Source§

impl<__Dyn: Any> Vtable<__Dyn> for dyn Any + Send + Sync

Source§

fn vtable<__Storage: Storage>() -> &'static Self::Vtable

Implementors§