Trait const_type_layout::TypeLayout
source · pub unsafe trait TypeLayout: Sized {
const TYPE_LAYOUT: TypeLayoutInfo<'static>;
unsafe fn uninit() -> MaybeUninhabited<MaybeUninit<Self>>;
}
Expand description
Safety
It is only safe to implement this trait if it accurately describes the
type’s layout. Use #[derive(TypeLayout)]
instead.
Required Associated Constants§
const TYPE_LAYOUT: TypeLayoutInfo<'static>
Required Methods§
sourceunsafe fn uninit() -> MaybeUninhabited<MaybeUninit<Self>>
unsafe fn uninit() -> MaybeUninhabited<MaybeUninit<Self>>
Safety
-
The returned value is not safe to be used in any other way than to calculate field offsets and discriminants.
-
The value and any value built with it must NOT be dropped.
-
Must return
MaybeUninhabited::Uninhabited
iff the type is uninhabited.