[][src]Macro tinyvec::tiny_vec

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

Helper to make a TinyVec.

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_tv = tiny_vec!([u8; 16]);
let some_ints = tiny_vec!([i32; 4], 1, 2, 3);
let many_ints = tiny_vec!([i32; 4], 1, 2, 3, 4, 5, 6, 7, 8, 9, 10);

// Or left to inference
let empty_tv: TinyVec<[u8; 16]> = tiny_vec!();
let some_ints: TinyVec<[i32; 4]> = tiny_vec!(1, 2, 3);
let many_ints: TinyVec<[i32; 4]> = tiny_vec!(1, 2, 3, 4, 5, 6, 7, 8, 9, 10);