Struct core::ptr::DynMetadata [−][src]
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 it contains:
- type size
- type alignment
- a pointer to the type’s
drop_in_place
impl (may be a no-op for plain-old-data) - pointers to all the methods for the type’s implementation of the trait
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.
Implementations
impl<Dyn: ?Sized> DynMetadata<Dyn>
[src]
pub fn size_of(self) -> usize
[src]
Returns the size of the type associated with this vtable.
pub fn align_of(self) -> usize
[src]
Returns the alignment of the type associated with this vtable.
pub fn layout(self) -> Layout
[src]
Returns the size and alignment together as a Layout
Trait Implementations
impl<Dyn: ?Sized> Clone for DynMetadata<Dyn>
[src]
fn clone(&self) -> Self
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<Dyn: ?Sized> Copy for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> Debug for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> Eq for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> Hash for DynMetadata<Dyn>
[src]
fn hash<H: Hasher>(&self, hasher: &mut H)
[src]
fn hash_slice<H: Hasher>(data: &[Self], state: &mut H) where
Self: Sized,
1.3.0[src]
Self: Sized,
impl<Dyn: ?Sized> Ord for DynMetadata<Dyn>
[src]
fn cmp(&self, other: &Self) -> Ordering
[src]
#[must_use]fn max(self, other: Self) -> Self where
Self: Sized,
1.21.0[src]
Self: Sized,
#[must_use]fn min(self, other: Self) -> Self where
Self: Sized,
1.21.0[src]
Self: Sized,
#[must_use]fn clamp(self, min: Self, max: Self) -> Self where
Self: Sized,
1.50.0[src]
Self: Sized,
impl<Dyn: ?Sized> PartialEq<DynMetadata<Dyn>> for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> PartialOrd<DynMetadata<Dyn>> for DynMetadata<Dyn>
[src]
fn partial_cmp(&self, other: &Self) -> Option<Ordering>
[src]
#[must_use]fn lt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn le(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn gt(&self, other: &Rhs) -> bool
1.0.0[src]
#[must_use]fn ge(&self, other: &Rhs) -> bool
1.0.0[src]
impl<Dyn: ?Sized> Send for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> Sync for DynMetadata<Dyn>
[src]
impl<Dyn: ?Sized> Unpin for DynMetadata<Dyn>
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut Self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,