macro_rules! collection {
($($x:expr),*) => { ... };
($($k:expr => $v:expr),*) => { ... };
($($x:expr),+,) => { ... };
($($k:expr => $v:expr),+,) => { ... };
}Expand description
Anything that implements the Create trait can be used with this
ยงExamples
#[macro_use]
extern crate data_structure_traits;
#[cfg(feature = "hashmap_core")]
extern crate hashmap_core;
#[cfg(feature = "std")]
use std::collections::{HashMap, HashSet};
#[cfg(feature = "hashmap_core")]
use hashmap_core::{FnvHashMap as HashMap, FnvHashSet as HashSet};
fn main() {
// HashMap
let map: HashMap<&str, usize> = collection!{
"a" => 1,
"b" => 2,
"c" => 3,
};
// Vec
let vec: Vec<usize> = collection![0, 1, 2, 3];
}