Another solution is to use the indexmap crate, and impl Equivalent<Key> for KeyRef.
mbrubeck
4
Related topics
| Topic | Replies | Views | Activity | |
|---|---|---|---|---|
| HashMap with lookup by key variant that has references? | 8 | 332 | April 8, 2026 | |
| The Borrow trait and structs as HashMap keys | 2 | 1187 | July 10, 2018 | |
|
Querying HashMap when Borrow<T> can't be satisfied
|
8 | 970 | October 14, 2022 | |
| `HashMap::get` where key type owns string, but using a &str | 8 | 519 | January 31, 2025 | |
| Efficient multi-string HashMap keys | 3 | 923 | November 25, 2020 |