Macro generic_array::arr

source ·
macro_rules! arr {
    ($($x:expr),* $(,)*) => { ... };
    ($x:expr; $N:ty) => { ... };
}
Expand description

Macro allowing for easy generation of Generic Arrays.

Type-inference works similarly to vec![]

Can be used in const contexts.

Example:

use generic_array::typenum::U6;

let test = arr![1, 2, 3]; // implicit length
let test = arr![1; U6];   // explicit length

NOTE: As of generic-array 1.0, From can be used for a wide range of regular arrays as well.