macro_rules! staticvec {
    ($($val:expr),* $(,)*) => { ... };
    ($val:expr; $n:expr) => { ... };
}
Expand description

Creates a new StaticVec from a vec!-style pseudo-slice. The newly created StaticVec will have a capacity and length exactly equal to the number of elements in the so-called slice. The “array-like” [value; N] syntax is also supported, and both forms can be used in const contexts. This macro has no particular trait impl requirements for the input type.

Example usage:

use staticvec::{staticvec, StaticVec};

// The type of the StaticVec on the next line is `StaticVec<Vec<StaticVec<i32, 4>>, 1>`.
let v = staticvec![vec![staticvec![1, 2, 3, 4]]];

// The type of the StaticVec on the next line is `StaticVec<f64, 64>`.
let v2 = staticvec![12.0; 64];

const V3: StaticVec<i32, 4> = staticvec![1, 2, 3, 4];
assert_eq!(V3, [1, 2, 3, 4]);

static V4: StaticVec<i32, 128> = staticvec![27; 128];
assert!(V4 == [27; 128]);