macro_rules! hash_set { () => { ... }; ($($elem:expr),*) => { ... }; }
Expand description
Creates a new HashSet instance.
This macro can be used in two forms:
- Without arguments, it creates an empty
HashSet. - With elements, it creates a
HashSetand inserts the provided elements into it.
ยงExamples
Creating an empty HashSet:
use std_macro_extensions::*;
let my_set = hash_set!();
assert!(my_set.is_empty());Creating a HashSet with elements:
use std_macro_extensions::*;
let my_set = hash_set!(1, 2, 3);
assert!(my_set.contains(&1));
assert!(my_set.contains(&2));
assert!(my_set.contains(&3));