aligned_box: Allocate aligned heap memory in Rust.
aligned_box provides traits and implementations for the allocation of aligned heap memory. It adds new constructors to
std::boxed::Box
in order to do aligned allocations.
Examples
Place value 17 of type i32
on the heap, aligned to 64 bytes:
use AlignedBox;
let b = Box:: new_aligned;
Allocate memory for 1024 values of type f32
on the heap, aligned to 128 bytes. Values are initialized by their default value:
use AlignedBoxedSliceFromDefault;
let b = Box:: new_aligned_slice_from_default;
Allocate memory for 1024 values of type f32
on the heap, aligned to 128 bytes. All values are initialized with PI:
use AlignedBoxedSliceFromValue;
let b = Box:: new_aligned_slice_from_value;