[][src]Macro common_macros::hash_set

macro_rules! hash_set {
    (with $set:expr; insert { $($item:expr),* , }) => { ... };
    (with $set:expr; insert { $($item:expr),* }) => { ... };
    ($($item:expr),* ,) => { ... };
    ($($item:expr),*) => { ... };
}

Macro to create a HashSet with a number of items in it.

Like for HashMap an alternate syntax for insertion exists, it also call .reserve() with the number of passed in items.

Examples

use common_macros::hash_set;

let is_fun_set = hash_set!{ "joke", "cat" };
use std::collections::HashSet;
use common_macros::hash_set;

let mut set = HashSet::new();
hash_set!(with &mut set; insert {
    "hy",
    "ho",
    "starts",
    "and",
    "so"
});