unaligned_uninitialized_vec

Function unaligned_uninitialized_vec 

Source
pub unsafe fn unaligned_uninitialized_vec<T>(
    size: usize,
) -> Result<Vec<T>, Error>
Expand description

Create an unaligned uninitialized vector with the given size.

ยงSafety

Caller must ensure that the vector is properly initialized before using it.

This is not a very good function, since set_len on uninitialized memory is undefined-behavior (UB). Nevertheless, if T is some type of MaybeUninit, then this will not UB.