[][src]Struct abi_stable::sabi_trait::VTableTO

pub struct VTableTO<_Self, OrigPtr, Unerasability, V, DT> { /* fields omitted */ }

This is used to safely pass the vtable to #[sabi_trait] generated trait objects, using <Trait>_CTO::from_const( &value, <Trait>_MV::VTABLE ).

<Trait> is whatever the name of the trait that one is constructing the trait object for.

Implementations

impl<_Self, OrigPtr, Unerasability, V> VTableTO<_Self, OrigPtr, Unerasability, V, ()>[src]

pub const unsafe fn for_robject(vtable: PrefixRef<V>) -> Self[src]

Wraps an erased vtable.

Safety

These are the requirements for the caller:

  • OrigPtr must be a pointer to the type that the vtable functions take as the first parameter.

  • The vtable must not come from a reborrowed RObject (created using RObject::reborrow or RObject::reborrow_mut).

  • The vtable must be the <SomeVTableName> of a struct declared with #[derive(StableAbi)]``#[sabi(kind(Prefix(prefix_ref="<SomeVTableName>")))].

  • The vtable must have PrefixRef<RObjectVtable<..>> as its first declared field

impl<_Self, OrigPtr, Unerasability, V, DT> VTableTO<_Self, OrigPtr, Unerasability, V, DT>[src]

pub const fn robject_vtable(&self) -> PrefixRef<V>[src]

Gets the vtable that RObject is constructed with.

impl<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability, V> VTableTO<_Self, OrigPtr, Unerasability, V, VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability>>[src]

pub const fn dyntrait_vtable(
    &self
) -> VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability>
[src]

Gets the vtable for DynTrait.

impl<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability, V> VTableTO<_Self, OrigPtr, Unerasability, V, VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability>>[src]

pub const unsafe fn for_dyntrait(
    vtable: PrefixRef<V>,
    for_dyn_trait: VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Unerasability>
) -> Self
[src]

Wraps an erased vtable,alongside the vtable for DynTrait.

Safety

This has the same safety requirements as the 'for_robject' constructor

Trait Implementations

impl<_Self, OrigPtr, Unerasability, V, DT> Clone for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: Copy
[src]

impl<_Self, OrigPtr, Unerasability, V, DT> Copy for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: Copy
[src]

Auto Trait Implementations

impl<_Self, OrigPtr, Unerasability, V, DT> RefUnwindSafe for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: RefUnwindSafe,
    V: RefUnwindSafe

impl<_Self, OrigPtr, Unerasability, V, DT> Send for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: Send,
    V: Sync

impl<_Self, OrigPtr, Unerasability, V, DT> Sync for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: Sync,
    V: Sync

impl<_Self, OrigPtr, Unerasability, V, DT> Unpin for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: Unpin

impl<_Self, OrigPtr, Unerasability, V, DT> UnwindSafe for VTableTO<_Self, OrigPtr, Unerasability, V, DT> where
    DT: UnwindSafe,
    V: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'a, T> BorrowOwned<'a> for T where
    T: 'a + Clone
[src]

type ROwned = T

The owned type, stored in RCow::Owned

type RBorrowed = &'a T

The borrowed type, stored in RCow::Borrowed

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

impl<T> GetWithMetadata for T[src]

type ForSelf = WithMetadata_<T, T>

This is always WithMetadata_<Self, Self>

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> SelfOps for T where
    T: ?Sized
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<This> TransmuteElement for This where
    This: ?Sized
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The error type returned when the conversion fails.

impl<T> TypeIdentity for T where
    T: ?Sized
[src]

type Type = T

The same type as Self. Read more