std_macro_extensions/hash_set/macro.rs
1/// Creates a new `HashSet` instance.
2///
3/// This macro can be used in two forms:
4/// - Without arguments, it creates an empty `HashSet`.
5/// - With elements, it creates a `HashSet` and inserts the provided elements into it.
6#[macro_export]
7macro_rules! hash_set {
8 () => {
9 std::collections::HashSet::new()
10 };
11 ($($elem:expr),*) => {{
12 let mut set = std::collections::HashSet::new();
13 $( set.insert($elem); )*
14 set
15 }};
16}