-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
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
HashTable::iter_hash
HashTable::iter_hash
, HashTable::iter_hash_mut
@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_hash
from the old raw API can be useful for reading from a "bag" / "multi map" type which allows duplicate key-value pairs. Exposing it safely inHashTable
takes a fairly small wrapper aroundRawIterHash
. This PR partially reverts #546 to restoreRawTable::iter_hash
and its associated types.