[][src]Macro tinyvec::array_vec

macro_rules! array_vec {
    ($array_type:ty) => { ... };
    ($array_type:ty, $($elem:expr),*) => { ... };
    () => { ... };
    ($($elem:expr),*) => { ... };
}

Helper to make an ArrayVec.

You specify the backing array type, and optionally give all the elements you want to initially place into the array.

As an unfortunate restriction, the backing array type must support Default for it to work with this macro.

use tinyvec::*;

// The backing array type can be specified in the macro call
let empty_av = array_vec!([u8; 16]);
let some_ints = array_vec!([i32; 4], 1, 2, 3);

// Or left to inference
let empty_av: ArrayVec<[u8; 10]> = array_vec!();
let some_ints: ArrayVec<[u8; 10]> = array_vec!(5, 6, 7, 8);