uninitialized_vec

Function uninitialized_vec 

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

Create an uninitialized vector with the given size.

This function depends on aligned_alloc feature. If aligned_alloc is enabled, it will align at 64-bit when size of vector elements is larger than 128.

ยง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.