Struct vtable::VRef [−][src]
#[repr(transparent)]pub struct VRef<'a, T: ?Sized + VTableMeta> { /* fields omitted */ }
Expand description
VRef<'a MyTraitVTable>
can be thought as a &'a dyn MyTrait
It will dereference to a structure that has the same members as MyTrait.
Implementations
Create a new VRef from an reference of a type that can be associated with a VTable.
(the HasStaticVTable
is implemented by the “MyTrait”VTable_static!
macro generated by
the #vtable macro)
Create a new Pin<VRef<_>> from a pinned reference. This is similar to VRef::new
.
Create a new VRef from raw pointers
Safety
The ptr
needs to be a valid object fitting the vtable
.
Both vtable and ptr lifetime must outlive ’a
Return a reference of the given type if the type is matching.
Return a reference of the given type if the type is matching
Trait Implementations
Auto Trait Implementations
impl<'a, T: ?Sized> RefUnwindSafe for VRef<'a, T> where
<T as VTableMeta>::Target: RefUnwindSafe,
impl<'a, T: ?Sized> UnwindSafe for VRef<'a, T> where
<T as VTableMeta>::Target: RefUnwindSafe,
Blanket Implementations
Mutably borrows from an owned value. Read more