[−][src]Macro staticvec::staticvec
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 slice. The "array-like" [value; N]
syntax is also supported,
and both forms can be used in const contexts.
Example usage:
// 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]); const V4: StaticVec<i32, 128> = staticvec![27; 128]; assert!(V4 == [27; 128]);