Add HashTable::iter_hash, HashTable::iter_hash_mut#549
Conversation
This partially reverts 26ef4a1 so that the child commit can expose a safe `iter_hash` in `HashTable::iter_hash`.
This is a safe wrapper around `RawTable::iter_hash`. `iter_hash` can be useful for looking up duplicate values in the table. For example you might use it to build a "bag" / "multi map" type which blindly inserts with `HashTable::insert_unique` and allows lookup of multiple values for the same key.
|
Should there be a |
|
For my use-case I will only need to read entries as-is after insertion. I could see mutation being useful hypothetically though. Maybe that could benefit from some kind of iterator that returns |
|
Returning |
ab005f6 to
8b60594
Compare
|
@bors r+ |
|
☀️ Test successful - checks-actions |
|
Thanks @Amanieu! My multi map type is much cleaner as a HashTable now :) |
This is a follow-up to #546 (comment).
iter_hashfrom the old raw API can be useful for reading from a "bag" / "multi map" type which allows duplicate key-value pairs. Exposing it safely inHashTabletakes a fairly small wrapper aroundRawIterHash. This PR partially reverts #546 to restoreRawTable::iter_hashand its associated types.