generic_array

Macro box_arr

Source
macro_rules! box_arr {
    ($($x:expr),* $(,)*) => { ... };
    ($x:expr; $N:ty) => { ... };
    ($x:expr; $n:expr) => { ... };
}
Available on crate feature alloc only.
Expand description

Like arr!, but returns a Box<GenericArray<T, N>>

Unlike arr!, this is not limited by stack size, only the heap.

Example:

// allocate a 16MB Buffer of u128 elements (16 bytes * 10 ^ 6)
let test = box_arr![1u128; typenum::Exp<U10, U6>];
//  test: Box<GenericArray<u128, _>>

ยงNOTES AND LIMITATIONS

  • The [T; usize] explicit and [0, 1, 2, 3] implicit forms are limited to lengths supported by Const<U>