pub struct ThinRef<'a, Trait: ?Sized> { /* private fields */ }Expand description
A thin reference (size = size_of::<usize>()) to an object implementing the trait Trait
This is like a reference to a trait (&dyn Trait) for struct that used
the macro #[vptr(Trait)]
See the crate documentation for example of usage.
The size is only the size of a single pointer:
assert_eq!(mem::size_of::<ThinRef<dyn Trait>>(), mem::size_of::<usize>());
assert_eq!(mem::size_of::<Option<ThinRef<dyn Trait>>>(), mem::size_of::<usize>());Trait Implementations§
impl<'a, Trait: ?Sized> Copy for ThinRef<'a, Trait>
Auto Trait Implementations§
impl<'a, Trait> Freeze for ThinRef<'a, Trait>where
Trait: ?Sized,
impl<'a, Trait> RefUnwindSafe for ThinRef<'a, Trait>where
Trait: RefUnwindSafe + ?Sized,
impl<'a, Trait> Send for ThinRef<'a, Trait>
impl<'a, Trait> Sync for ThinRef<'a, Trait>
impl<'a, Trait> Unpin for ThinRef<'a, Trait>where
Trait: ?Sized,
impl<'a, Trait> UnwindSafe for ThinRef<'a, Trait>where
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