[][src]Struct vptr::ThinRef

pub struct ThinRef<'a, Trait: ?Sized> { /* fields omitted */ }

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> Clone for ThinRef<'a, Trait>[src]

impl<'a, Trait: ?Sized + 'a, T: HasVPtr<Trait>> From<&'a T> for ThinRef<'a, Trait>[src]

impl<'a, Trait: ?Sized> Copy for ThinRef<'a, Trait>[src]

impl<'a, Trait: ?Sized + 'a> Deref for ThinRef<'a, Trait>[src]

type Target = Trait

The resulting type after dereferencing.

impl<'a, Trait: ?Sized + 'a> Borrow<Trait> for ThinRef<'a, Trait>[src]

Auto Trait Implementations

impl<'a, Trait: ?Sized> Send for ThinRef<'a, Trait> where
    Trait: Sync

impl<'a, Trait: ?Sized> Unpin for ThinRef<'a, Trait>

impl<'a, Trait: ?Sized> Sync for ThinRef<'a, Trait> where
    Trait: Sync

impl<'a, Trait: ?Sized> UnwindSafe for ThinRef<'a, Trait> where
    Trait: RefUnwindSafe

impl<'a, Trait: ?Sized> RefUnwindSafe for ThinRef<'a, Trait> where
    Trait: RefUnwindSafe

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]