Macro data_structure_traits::collection
[−]
[src]
macro_rules! collection { ($($x:expr),*) => { ... }; ($($k:expr => $v:expr),*) => { ... }; ($($x:expr),+,) => { ... }; ($($k:expr => $v:expr),+,) => { ... }; }
Anything that implements the Create
trait can be used with this
Examples
#[macro_use] extern crate data_structure_traits; use std::collections::HashMap; fn main() { // HashMap let map: HashMap<String, usize> = collection!{ "a".into() => 1, "b".into() => 2, "c".into() => 3, }; // Vec let vec: Vec<usize> = collection![0, 1, 2, 3]; }