Macro generic_array::arr 
source · macro_rules! arr { ($($x:expr),* $(,)*) => { ... }; ($x:expr; $N:ty) => { ... }; ($x:expr; $n:expr) => { ... }; }
Expand description
Macro allowing for easy construction of Generic Arrays.
Type-inference works similarly to vec![]
arr! can be used in const expressions.
Example:
use generic_array::typenum::U6;
let test = arr![1, 2, 3]; // implicit length
let test = arr![1; 6];    // explicit length via `Const<N>`
let test = arr![1; U6];   // explicit length via typenumNOTES AND LIMITATIONS
- As of generic-array 1.0,From/from_arraycan be used directly for a wide range of regular arrays.
- The [T; N: ArrayLength]and[T; usize]explicit forms are limited toCopyvalues. UseGenericArray::generate(|| value.clone())for non-Copyitems.
- The [T; usize]explicit and[0, 1, 2, 3]implicit forms are limited to lengths supported byConst<U>