Skip to content

Commit

Permalink
Merge #54
Browse files Browse the repository at this point in the history
54: Raw entry hasher r=Amanieu a=sujayakar

This PR allows the user to create a `HashMap` where `K` doesn't implement `Hash`, so long as they are okay with only using the raw entry API.

The first step is to move around some methods that didn't actually depend on `K: Hash`.  Then, the only non-plumbing change was to defer the `.reserve(1)` call on `raw_entry_mut` to right before insertion.  Then, we expose a new method `RawVacantEntryMut::insert_with_hasher` that takes in the custom hashing function and passes it in to `reserve` before inserting.

@Amanieu do these API changes merit a version bump?  I think we're only allowing these methods to be used on _more_ types, but let me know.

Closes #44 

Co-authored-by: Sujay Jayakar <[email protected]>
  • Loading branch information
bors[bot] and Sujay Jayakar committed Mar 17, 2019
2 parents 00ba2f9 + b3717fd commit edf79d0
Showing 1 changed file with 225 additions and 160 deletions.
Loading

0 comments on commit edf79d0

Please sign in to comment.