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