pub struct Ref<'a, Trait: ?Sized + DynTrait> { /* private fields */ }Expand description
A shared reference to a tinydyn trait object.
Ref<dyn Trait> can call the &self methods of Trait through its Deref impl.
It can also be freely cloned and copied like a &dyn Trait.
Prefer passing this around rather than calling deref and passing around that reference
- that would create a double pointer.
Implementations§
Source§impl<'a, Trait: ?Sized + DynTrait> Ref<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait> Ref<'a, Trait>
Source§impl<'a, Trait: ?Sized + DynTrait + Send + 'a> Ref<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait + Send + 'a> Ref<'a, Trait>
Sourcepub fn remove_send(self) -> Ref<'a, Trait::RemoveSend>
pub fn remove_send(self) -> Ref<'a, Trait::RemoveSend>
Removes the Send bound from Trait, if any.
Source§impl<'a, Trait: ?Sized + DynTrait + Sync + 'a> Ref<'a, Trait>
impl<'a, Trait: ?Sized + DynTrait + Sync + 'a> Ref<'a, Trait>
Sourcepub fn remove_sync(self) -> Ref<'a, Trait::RemoveSync>
pub fn remove_sync(self) -> Ref<'a, Trait::RemoveSync>
Removes the Sync bound from Trait, if any.
Trait Implementations§
impl<'a, Trait: ?Sized + DynTrait + 'a> Copy for Ref<'a, Trait>
impl<'a, Trait> Send for Ref<'a, Trait>
impl<'a, Trait> Sync for Ref<'a, Trait>
Auto Trait Implementations§
impl<'a, Trait> Freeze for Ref<'a, Trait>
impl<'a, Trait> RefUnwindSafe for Ref<'a, Trait>where
<<Trait as DynTrait>::Plain as PlainDyn>::Metadata: RefUnwindSafe,
Trait: RefUnwindSafe + ?Sized,
impl<'a, Trait> Unpin for Ref<'a, Trait>
impl<'a, Trait> UnwindSafe for Ref<'a, Trait>where
<<Trait as DynTrait>::Plain as PlainDyn>::Metadata: UnwindSafe,
Trait: RefUnwindSafe + ?Sized,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more