Macro o1_utils::box_array

source ·
macro_rules! box_array {
    ($val:expr ; $len:expr) => { ... };
}
Expand description

A macro similar to vec![$elem; $size] which returns a boxed array, allocated directly on the heap (via a vector, with reallocations).

    let _: Box<[u8; 1024]> = box_array![0; 1024];

See https://stackoverflow.com/questions/25805174/creating-a-fixed-size-array-on-heap-in-rust/68122278#68122278