Struct abi_stable::sabi_trait::VTableTO [−][src]
pub struct VTableTO<_Self, OrigPtr, Downcasting, V, DT> { /* fields omitted */ }
Expand description
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
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
Gets the vtable that RObject is constructed with.
pub const fn dyntrait_vtable(
&self
) -> VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Downcasting>
pub const fn dyntrait_vtable(
&self
) -> VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Downcasting>
Gets the vtable for DynTrait.
pub const unsafe fn for_dyntrait(
vtable: PrefixRef<V>,
for_dyn_trait: VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Downcasting>
) -> Self
pub const unsafe fn for_dyntrait(
vtable: PrefixRef<V>,
for_dyn_trait: VTableDT<'borr, _Self, ErasedPtr, OrigPtr, I, Downcasting>
) -> Self
Wraps an erased vtable,alongside the vtable for DynTrait.
Safety
This has the same safety requirements as the ‘for_robject’ constructor
Trait Implementations
Auto Trait Implementations
impl<_Self, OrigPtr, Downcasting, V, DT> RefUnwindSafe for VTableTO<_Self, OrigPtr, Downcasting, V, DT> where
DT: RefUnwindSafe,
V: RefUnwindSafe,
impl<_Self, OrigPtr, Downcasting, V, DT> Send for VTableTO<_Self, OrigPtr, Downcasting, V, DT> where
DT: Send,
V: Sync,
impl<_Self, OrigPtr, Downcasting, V, DT> Sync for VTableTO<_Self, OrigPtr, Downcasting, V, DT> where
DT: Sync,
V: Sync,
impl<_Self, OrigPtr, Downcasting, V, DT> Unpin for VTableTO<_Self, OrigPtr, Downcasting, V, DT> where
DT: Unpin,
impl<_Self, OrigPtr, Downcasting, V, DT> UnwindSafe for VTableTO<_Self, OrigPtr, Downcasting, V, DT> where
DT: UnwindSafe,
V: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more
type ROwned = T
type ROwned = T
The owned type, stored in RCow::Owned
type ForSelf = WithMetadata_<T, T>
type ForSelf = WithMetadata_<T, T>
This is always WithMetadata_<Self, Self>
Compares the address of self
with the address of other
. Read more
Emulates the pipeline operator, allowing method syntax in more places. Read more
The same as piped
except that the function takes &Self
Useful for functions that take &Self
instead of Self
. Read more
The same as piped
, except that the function takes &mut Self
.
Useful for functions that take &mut Self
instead of Self
. Read more
Mutates self using a closure taking self by mutable reference, passing it along the method chain. Read more
Observes the value of self, passing it along unmodified. Useful in long method chains. Read more
Performs a conversion with Into
.
using the turbofish .into_::<_>()
syntax. Read more
Performs a reference to reference conversion with AsRef
,
using the turbofish .as_ref_::<_>()
syntax. Read more
Performs a mutable reference to mutable reference conversion with AsMut
,
using the turbofish .as_mut_::<_>()
syntax. Read more
unsafe fn transmute_element<T>(
self
) -> <Self as CanTransmuteElement<T>>::TransmutedPtr where
Self: CanTransmuteElement<T>,
unsafe fn transmute_element<T>(
self
) -> <Self as CanTransmuteElement<T>>::TransmutedPtr where
Self: CanTransmuteElement<T>,
Transmutes the element type of this pointer.. Read more
type Type = T
type Type = T
This is always Self
.
Converts a value back to the original type.
Converts a mutable reference back to the original type.
Converts a box back to the original type.
Converts an Arc back to the original type. Read more
Converts an Rc back to the original type. Read more
Converts a value back to the original type.
Converts a reference back to the original type.
Converts a mutable reference back to the original type.
Converts a box back to the original type.
Converts an Arc back to the original type.
Converts an Rc back to the original type.