Struct DynMetadata

struct DynMetadata<Dyn: PointeeSized> { ... }

The metadata for a Dyn = dyn SomeTrait trait object type.

It is a pointer to a vtable (virtual call table) that represents all the necessary information to manipulate the concrete type stored inside a trait object. The vtable notably contains:

Note that the first three are special because they’re necessary to allocate, drop, and deallocate any trait object.

It is possible to name this struct with a type parameter that is not a dyn trait object (for example DynMetadata<u64>) but not to obtain a meaningful value of that struct.

Note that while this type implements PartialEq, comparing vtable pointers is unreliable: pointers to vtables of the same type for the same trait can compare inequal (because vtables are duplicated in multiple codegen units), and pointers to vtables of different types/traits can compare equal (since identical vtables can be deduplicated within a codegen unit).

Implementations

impl<Dyn: PointeeSized> DynMetadata<Dyn>

fn size_of(self: Self) -> usize

Returns the size of the type associated with this vtable.

fn align_of(self: Self) -> usize

Returns the alignment of the type associated with this vtable.

fn layout(self: Self) -> Layout

Returns the size and alignment together as a Layout

impl<Dyn> Freeze for DynMetadata<Dyn>

impl<Dyn> RefUnwindSafe for DynMetadata<Dyn>

impl<Dyn> UnsafeUnpin for DynMetadata<Dyn>

impl<Dyn> UnwindSafe for DynMetadata<Dyn>

impl<Dyn: PointeeSized> Clone for DynMetadata<Dyn>

fn clone(self: &Self) -> Self

impl<Dyn: PointeeSized> Copy for DynMetadata<Dyn>

impl<Dyn: PointeeSized> Debug for DynMetadata<Dyn>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<Dyn: PointeeSized> Eq for DynMetadata<Dyn>

impl<Dyn: PointeeSized> Hash for DynMetadata<Dyn>

fn hash<H: Hasher>(self: &Self, hasher: &mut H)

impl<Dyn: PointeeSized> Ord for DynMetadata<Dyn>

fn cmp(self: &Self, other: &Self) -> Ordering

impl<Dyn: PointeeSized> PartialEq for DynMetadata<Dyn>

fn eq(self: &Self, other: &Self) -> bool

impl<Dyn: PointeeSized> PartialOrd for DynMetadata<Dyn>

fn partial_cmp(self: &Self, other: &Self) -> Option<Ordering>

impl<Dyn: PointeeSized> Send for DynMetadata<Dyn>

impl<Dyn: PointeeSized> Sync for DynMetadata<Dyn>

impl<Dyn: PointeeSized> Unpin for DynMetadata<Dyn>

impl<T> Any for DynMetadata<Dyn>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for DynMetadata<Dyn>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for DynMetadata<Dyn>

fn borrow_mut(self: &mut Self) -> &mut T

impl<T> CloneToUninit for DynMetadata<Dyn>

unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)

impl<T> From for DynMetadata<Dyn>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for DynMetadata<Dyn>

fn into(self: Self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of [From]<T> for U chooses to do.

impl<T, U> TryFrom for DynMetadata<Dyn>

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

impl<T, U> TryInto for DynMetadata<Dyn>

fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>