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;
#[cfg(not(feature = "use_std"))] extern crate hashmap_core;

#[cfg(feature = "use_std")] use std::collections::{HashMap, HashSet};
#[cfg(not(feature = "use_std"))] use hashmap_core::{FnvHashMap as HashMap, FnvHashSet as HashSet};

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];
}