Struct DynDynRefMut

Source
pub struct DynDynRefMut<'a, B: ?Sized + DynDynBase, T: GetDynDynTable<B> + StableDeref + DerefMut>(/* private fields */);
Expand description

Wraps a mutable reference to a pointer implementing GetDynDynTable<B> and which can be dereferenced to perform the downcast.

Using dyn_dyn_cast! on this struct will call GetDynDynTable::get_dyn_dyn_table on the pointer itself, then dereference this pointer to perform the downcast. This allows a pointer implementing DynDyn<B> to be downcast into a mutable reference without moving the pointer itself.

Implementations§

Source§

impl<'a, B: ?Sized + DynDynBase, T: GetDynDynTable<B> + StableDeref + DerefMut> DynDynRefMut<'a, B, T>

Source

pub fn new(r: &'a mut T) -> Self

Creates a new DynDynRefMut for the provided mutable reference to a pointer.

Trait Implementations§

Source§

impl<'a, B: ?Sized + DynDynBase, T: DynDyn<'a, B> + StableDeref + DerefMut + 'a> DowncastUnchecked<'a> for DynDynRefMut<'a, B, T>
where T::Target: Unsize<B>,

Source§

type DowncastResult<D: ?Sized + 'a> = &'a mut D

The result of downcasting this pointer to point to the type D. Note that this type need not have the same outer wrapper as the type implementing DowncastUnchecked, since the result of the downcast may involve coercions and dereferences.
Source§

unsafe fn downcast_unchecked<D: ?Sized + Pointee>( self, metadata: <D as Pointee>::Metadata, ) -> Self::DowncastResult<D>

Downcasts this pointer into a new pointer pointing to the same object, but having type D. Read more
Source§

impl<'a, B: ?Sized + DynDynBase, T: DynDyn<'a, B> + StableDeref + DerefMut + 'a> GetDynDynTable<B> for DynDynRefMut<'a, B, T>
where T::Target: Unsize<B>,

Source§

type DynTarget = <T as Deref>::Target

The actual type that this pointer currently points to. This type is used to allow propagation of auto trait bounds such as Send and Sync in the dyn_dyn_cast! macro.
Source§

fn get_dyn_dyn_table(&self) -> DynDynTable

Gets the DynDynTable for the object that this pointer points to.

Auto Trait Implementations§

§

impl<'a, B, T> Freeze for DynDynRefMut<'a, B, T>
where B: ?Sized,

§

impl<'a, B, T> RefUnwindSafe for DynDynRefMut<'a, B, T>
where T: RefUnwindSafe, B: ?Sized,

§

impl<'a, B, T> Send for DynDynRefMut<'a, B, T>
where T: Send, B: ?Sized,

§

impl<'a, B, T> Sync for DynDynRefMut<'a, B, T>
where T: Sync, B: ?Sized,

§

impl<'a, B, T> Unpin for DynDynRefMut<'a, B, T>
where B: ?Sized,

§

impl<'a, B, T> !UnwindSafe for DynDynRefMut<'a, B, T>

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<'a, B, T> DynDyn<'a, B> for T