tinyvec

Macro tiny_vec

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

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.

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);