aligned_alloc

Function aligned_alloc 

Source
pub fn aligned_alloc(
    numbytes: usize,
    alignment: usize,
) -> Result<Option<NonNull<()>>, Error>
Expand description

Create an uninitialized vector with the given size and alignment.

  • Error: LayoutError if the layout cannot be created.
  • Ok(None): if the size is 0 or allocation fails.
  • Ok(Some): pointer to the allocated memory.

https://users.rust-lang.org/t/how-can-i-allocate-aligned-memory-in-rust/33293