Function uninit_tools::cast_init_to_uninit_slice [−][src]
pub fn cast_init_to_uninit_slice<U>(init: &[U]) -> &[MaybeUninit<U>]ⓘ
Cast a slice of bytes into a slice of uninitialized bytes, pretending that it is uninitialized.
This is completely safe, since MaybeUninit
must have the exact same (direct) layout, like
u8
has. The downside with this is that the information about initializedness is lost; unless
relying on unsafe code, the resulting slice can only be used to prove validity of the memory
range.