Function presser::maybe_uninit_slice_from_vec
source · pub unsafe fn maybe_uninit_slice_from_vec<T>(
vec: &mut Vec<T>,
length: usize
) -> &mut [MaybeUninit<T>]
Available on crate feature
std
only.Expand description
Takes a Vec
and unsafely resizes it to the given length, returning a mutable slice to MaybeUninit<T>
for each
item in the newly-resized Vec
.
Safety
You promise that the given Vec
already has at least length
capacity. You also promise to either fill all items before dropping
the returned slice, or to continue to not violate validity rules for any items that you do not initialize.