Function uninit_tools::cast_uninit_to_init_slice_mut[][src]

pub unsafe fn cast_uninit_to_init_slice_mut<U>(
    uninit: &mut [MaybeUninit<U>]
) -> &mut [U]

Notable traits for &'_ [u8]

impl<'_> Read for &'_ [u8]impl<'_> Write for &'_ mut [u8]

Cast a mutable slice of possibly initialized bytes into a slice of initialized bytes, assuming it is initialized.

Safety

For this to be safe, the initialization invariant must be upheld, exactly like when reading.

NOTE: This must not be used for initializing the buffer. If unsafe code is still somehow, always initialize this by copying from another MaybeUninit slice, or using std::ptr::copy or std::ptr::copy_nonoverlapping.