aligned_uninitialized_vec

Function aligned_uninitialized_vec 

Source
pub unsafe fn aligned_uninitialized_vec<T, const N: usize>(
    size: usize,
    alignment: usize,
) -> Result<Vec<T>>
Expand description

Create an conditionally aligned uninitialized vector with the given size.

The alignment is always 64 bytes.

  • N: condition for alignment; if N < size, then this function will not allocate aligned vector.

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