Question: In Rust, we can create a Vector with macro `vec![]`.

```
let numbers = vec![1, 2, 3];

```

Is there any similar macro that allow us to create a `HashSet`?

From the doc <https://doc.rust-lang.org/std/collections/struct.HashSet.html>, I notice that we have `HashSet::from`:

```
let viking_names = HashSet::from(["Einar", "Olaf", "Harald"]);

```

However, that requires us to create an array first, which seems a bit wasteful.

Answer: 
The standard library doesn't have a macro for this. [This crate](https://lib.rs/crates/map-macro) does provide one though.

As for the wastefulness, creating an array of string literals is pretty cheap, and is almost certainly optimized away.
If you fear the overhead of constructing the `HashSet` at runtime, or want this to be a `static`, the [phf](https://docs.rs/phf/latest/phf/macro.phf_set.html) crates might help you.