# tinyvec::array_vec - Rust
API documentation for the Rust `array_vec` macro in crate `tinyvec`.
Keywords: rust, rustlang, rust-lang, array_vec

# Macro tinyvec::array_vec [−] [src]

    macro_rules! array_vec {
        ($array_type:ty => $($elem:expr),* $(,)?) => { ... };
        ($array_type:ty) => { ... };
        ($($elem:expr),*) => { ... };
        ($elem:expr; $n: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.

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