Skip to main content

typed_vec

Macro typed_vec 

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

Creates a TypedVec containing the arguments.

typed_vec! allows TypedVec to be defined with the same syntax as the standard library’s vec! macro.

§Usage Example

use index_type::{IndexType, typed_vec};
use index_type::typed_vec::TypedVec;

#[derive(IndexType, Clone, Copy, PartialEq, Eq, PartialOrd, Ord)]
struct MyIndex(u32);

let v: TypedVec<MyIndex, i32> = typed_vec![1, 2, 3];
assert_eq!(v.len_usize(), 3);