Macro thin_vec::thin_vec

source ·
macro_rules! thin_vec {
    (@UNIT $($t:tt)*) => { ... };
    ($elem:expr; $n:expr) => { ... };
    () => { ... };
    ($($x:expr),*) => { ... };
    ($($x:expr,)*) => { ... };
}
Expand description

Creates a ThinVec containing the arguments.

#[macro_use] extern crate thin_vec;

fn main() {
    let v = thin_vec![1, 2, 3];
    assert_eq!(v.len(), 3);
    assert_eq!(v[0], 1);
    assert_eq!(v[1], 2);
    assert_eq!(v[2], 3);

    let v = thin_vec![1; 3];
    assert_eq!(v, [1, 1, 1]);
}