pub struct RefMut<'a, Trait: ?Sized + DynTrait> { /* private fields */ }Expand description
A mutable reference to a tinydyn trait object.
RefMut<dyn Trait> can call the &self and &mut self methods of Trait through its
Deref impl.
Like &mut dyn Trait, this cannot be cloned or copied. It can, however, be reborrowed.
Prefer passing this around rather than calling deref_mut and passing around that reference
- that would create a double pointer.
Implementations§
Source§impl<'a, Trait: ?Sized + DynTrait> RefMut<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait> RefMut<'a, Trait>
Source§impl<'a, Trait: ?Sized + DynTrait + 'a> RefMut<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait + 'a> RefMut<'a, Trait>
Sourcepub fn as_ref<'b>(&'b self) -> Ref<'b, Trait>
pub fn as_ref<'b>(&'b self) -> Ref<'b, Trait>
Reborrow as a shared Ref with a smaller lifetime.
Since a RefMut isn’t Copy, this is needed to pass to a function expecting a Ref and
regain access to the underlying RefMut after it’s done.
Sourcepub fn as_mut<'b>(&'b mut self) -> RefMut<'b, Trait>where
'a: 'b,
pub fn as_mut<'b>(&'b mut self) -> RefMut<'b, Trait>where
'a: 'b,
Reborrow as a RefMut with a smaller lifetime.
Since a RefMut isn’t Copy, this is needed to pass to a function expecting a RefMut
and regain access to the underlying RefMut after it’s done.
Sourcepub fn as_downcast_ptr<T>(&mut self) -> NonNull<T>
pub fn as_downcast_ptr<T>(&mut self) -> NonNull<T>
Downcasts this RefMut into a raw pointer of concrete type.
The pointer can accessed soundly for the lifetime of &mut self
so long as self was constructed from a &mut T.
Source§impl<'a, Trait: ?Sized + DynTrait + Send + 'a> RefMut<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait + Send + 'a> RefMut<'a, Trait>
Sourcepub fn remove_send(self) -> RefMut<'a, Trait::RemoveSend>
pub fn remove_send(self) -> RefMut<'a, Trait::RemoveSend>
Removes the Send bound from Trait, if any.
Source§impl<'a, Trait: ?Sized + DynTrait + Sync + 'a> RefMut<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait + Sync + 'a> RefMut<'a, Trait>
Sourcepub fn remove_sync(self) -> RefMut<'a, Trait::RemoveSync>
pub fn remove_sync(self) -> RefMut<'a, Trait::RemoveSync>
Removes the Sync bound from Trait, if any.