RefDyn

Struct RefDyn 

Source
#[repr(C)]
pub struct RefDyn<'a, Vtable: 'static> { /* private fields */ }

Implementations§

Source§

impl<'a, Vtable: 'static> RefDyn<'a, Vtable>

Source

pub const fn new<T>(value: &'a T) -> Self
where Vtable: VtableFor<T>,

Source

pub const unsafe fn from_ptr_vtable_unchecked( ptr: NonNull<()>, vtable: &'static Vtable, ) -> Self

§Safety

ptr must be valid to use with vtable

Source

pub const unsafe fn get_unchecked<T>(&self) -> &T

§Safety

ptr must point to a valid T

Source

pub const unsafe fn get_mut_unchecked<T>(&mut self) -> &mut T

§Safety

ptr must point to a valid T

Source

pub const fn vtable(&self) -> &'static Vtable

Source

pub const fn as_ptr(&self) -> NonNull<()>

Auto Trait Implementations§

§

impl<'a, Vtable> Freeze for RefDyn<'a, Vtable>

§

impl<'a, Vtable> RefUnwindSafe for RefDyn<'a, Vtable>
where Vtable: RefUnwindSafe,

§

impl<'a, Vtable> !Send for RefDyn<'a, Vtable>

§

impl<'a, Vtable> !Sync for RefDyn<'a, Vtable>

§

impl<'a, Vtable> Unpin for RefDyn<'a, Vtable>

§

impl<'a, Vtable> UnwindSafe for RefDyn<'a, Vtable>
where Vtable: RefUnwindSafe,

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.