Closed zRedShift closed 1 year ago
I think this might already possible with the current API.
static ARRAY: StaticCell<MaybeUninit<[u8; BIG_NUMBER]>> = StaticCell::new();
let arr = ARRAY.init(MaybeUninit::uninit());
unsafe {
arr.as_mut_ptr().write_bytes(0x00, BIG_NUMBER);
arr.assume_init_mut()
}
But the proposed uninit()
does clean-up the code above.
Sometimes I find myself using something that could be distilled to
ARRAY.init([0; BIG_NUMBER])
, whereWould guarantee no unnecessary memcpys or stack usage.