[][src]Struct vtable::VRefMut

#[repr(transparent)]pub struct VRefMut<'a, T: ?Sized + VTableMeta> { /* fields omitted */ }

VRefMut<'a MyTraitVTable> can be thought as a &'a mut dyn MyTrait

It will dereference to a structure that has the same members as MyTrait.

Implementations

impl<'a, T: ?Sized + VTableMeta> VRefMut<'a, T>[src]

pub fn new<X: HasStaticVTable<T>>(value: &'a mut X) -> Self[src]

Create a new VRef from a mutable 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)

pub unsafe fn from_raw(vtable: NonNull<T::VTable>, ptr: NonNull<u8>) -> Self[src]

Safety: the ptr needs to be a valid for the vtable, and properly allocated so it can be dropped

pub fn borrow<'b>(&'b self) -> VRef<'b, T>[src]

Borrow this to obtain a VRef.

pub fn borrow_mut<'b>(&'b mut self) -> VRefMut<'b, T>[src]

Borrow this to obtain a new VRefMut.

pub fn into_ref(self) -> VRef<'a, T>[src]

Create a VRef with the same lifetime as the original lifetime.

pub fn downcast<X: HasStaticVTable<T>>(&mut self) -> Option<&mut X>[src]

Return a reference of the given type if the type is matching.

Trait Implementations

impl<'a, T: ?Sized + VTableMeta> Deref for VRefMut<'a, T>[src]

type Target = T::Target

The resulting type after dereferencing.

impl<'a, T: ?Sized + VTableMeta> DerefMut for VRefMut<'a, T>[src]

Auto Trait Implementations

impl<'a, T: ?Sized> RefUnwindSafe for VRefMut<'a, T> where
    <T as VTableMeta>::Target: RefUnwindSafe

impl<'a, T> !Send for VRefMut<'a, T>

impl<'a, T> !Sync for VRefMut<'a, T>

impl<'a, T: ?Sized> Unpin for VRefMut<'a, T>

impl<'a, T> !UnwindSafe for VRefMut<'a, T>

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<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[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.