pub trait MaybeUninitSlice: Slice<Item = MaybeUninit<Self::InitItem>> {
type InitItem;
// Required methods
unsafe fn assume_init(&self) -> &[Self::InitItem];
unsafe fn assume_init_mut(&mut self) -> &mut [Self::InitItem];
}Expand description
Extension for maybe uninitialized slices ([MaybeUninit<_>])
Required Associated Types§
Required Methods§
Sourceunsafe fn assume_init(&self) -> &[Self::InitItem]
unsafe fn assume_init(&self) -> &[Self::InitItem]
Assume that all items of self are initialized
§Safety
It is up to the caller to guarantee that all elements of the array are
really in an initialized state. Calling this when the content is not
yet fully initialized causes immediate undefined behavior. The
MaybeUninit's type-level documentation contains
more information about this initialization invariant.
See also MaybeUninit::assume_init documentation.
Sourceunsafe fn assume_init_mut(&mut self) -> &mut [Self::InitItem]
unsafe fn assume_init_mut(&mut self) -> &mut [Self::InitItem]
Assume that all items of self are initialized
§Safety
It is up to the caller to guarantee that all elements of the array are
really in an initialized state. Calling this when the content is not
yet fully initialized causes immediate undefined behavior. The
MaybeUninit's type-level documentation contains
more information about this initialization invariant.
See also MaybeUninit::assume_init documentation.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.