macro_rules! space_uninit {
    ($capacity:expr) => { ... };
    ($like_ty:ty; $capacity:expr) => { ... };
}
Expand description

Creates an uninitialized array of MaybeUninit without allocating on the heap, suitable for taking a slice of to pass into BumpInto::from_slice.

Example

use bump_into::space_uninit;
use core::mem;

// an array of MaybeUninit<u8> is created by default:
let mut space = space_uninit!(64);
assert_eq!(mem::size_of_val(&space), 64);
assert_eq!(mem::align_of_val(&space), 1);
// if you need your space to have the alignment of a
// particular type, you can use an array-like syntax.
// this line will create an array of MaybeUninit<u32>:
let mut space = space_uninit!(u32; 16);
assert_eq!(mem::size_of_val(&space), 64);
assert_eq!(mem::align_of_val(&space), 4);