[−][src]Struct vtable::VRefMut
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]
Create a new VRefMut from raw pointers
Safety
The ptr
needs to be a valid object fitting the vtable
.
Both vtable and ptr lifetime must outlive 'a.
Can create mutable reference to ptr, so no other code can create mutable reference of ptr
during the life time 'a.
pub fn borrow(&self) -> VRef<'_, T>
[src]
Borrow this to obtain a VRef.
pub fn borrow_mut(&mut self) -> VRefMut<'_, 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.
pub fn deref(&self) -> &Self::Target
[src]
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,
<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]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,