Function konst::maybe_uninit::uninit_array
source · pub const fn uninit_array<T, const LEN: usize>() -> [MaybeUninit<T>; LEN]
Expand description
Const equivalent of MaybeUninit::uninit_array
§Example
use konst::maybe_uninit as mu;
use std::mem::{self, MaybeUninit};
const INITS: [u8; 2] = {
let mut uninits = mu::uninit_array::<u8, 2>();
uninits[0] = MaybeUninit::new(21);
uninits[1] = MaybeUninit::new(34);
unsafe{ mu::array_assume_init(uninits) }
};
assert_eq!(INITS, [21, 34]);