Macro bump_into::space_uninit_aligned
source · macro_rules! space_uninit_aligned { (size: $size:expr, align: $align:literal $(,)?) => { ... }; }
Expand description
Creates an uninitialized array of one MaybeUninit
without
allocating on the heap, with the given size and alignment,
suitable for taking a slice of to pass into BumpInto::from_slice
.
The size will be rounded up to the nearest multiple of the given alignment.
The size must be a const expression of type usize
.
The alignment must be a power-of-two integer literal.
Example
use bump_into::space_uninit_aligned;
use core::mem;
let mut space = space_uninit_aligned!(size: 64, align: 4);
assert_eq!(mem::size_of_val(&space), 64);
assert_eq!(mem::align_of_val(&space), 4);