8 ms·
You can. https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html#method.or_insert https://doc.rust-lang.org/std/collections/hash_map/enum.Entr...
by GrumpySloth 3y ago
You can.
https://doc.rust-lang.org/std/collections/hash_map/enum.Entry.html#method.or_insert https://doc.rust-lang.org/std/collections/hash_map/enum.Entr...
- IshKebab 3y agoYou can't. `entry()` takes they key by value, not by reference: https://doc.rust-lang.org/std/collections/hash_map/struct.HashMap.html#method.entry https://doc.rust-lang.org/std/collections/hash_map/struct.Ha... You might be getting confused because in that example the `HashMap` keys are references.
- GrumpySloth 3y agoMy bad. That’s not been an issue in my code, as I use arenas to manage memory and never put an owning container as key in a HashMap.