Macro uninit::uninit_array

source ·
macro_rules! uninit_array {
    (
    $T:ty ; $count:expr
) => { ... };
}
Expand description

Sets up an inline / stack-allocated array of uninitialized elements.

Example

use ::uninit::{prelude::*, read::ReadIntoUninit};

let mut reader = &b"Hello, World!"[..];
let mut backing_array = uninit_array![u8; 4]; // : [MaybeUninit<u8>; 4]
let buf = backing_array.as_out();
assert_eq!(
    reader.read_into_uninit_exact(buf).unwrap(),
    b"Hell",
);