Skip to content
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

Provide default hasher types to Vacant and Occupied entries #389

Merged
merged 1 commit into from
Jan 22, 2023

Conversation

TheBlueMatt
Copy link
Contributor

For code which may select to use the std HashMap or the hashbrown HashMap based on feature or cfg flags, being forced to provide an explicit hash argument to VacantEntry or OccupiedEntry structs requires jumping through some hoops. Specifically, the std hash_map::*Entry structs don't take a hasher type argument at all, making the downstream code change the type entirely when switching from std to hashbrown or back.

For simplicity, its nice to have the argument be optional on the hashbrown end, which would let the same code compile with either map.

For code which may select to use the `std` `HashMap` or the
`hashbrown` `HashMap` based on feature or cfg flags, being forced
to provide an explicit hash argument to `VacantEntry` or
`OccupiedEntry` structs requires jumping through some hoops.
Specifically, the `std` `hash_map::*Entry` structs don't take a
hasher type argument at all, making the downstream code change the
type entirely when switching from `std` to `hashbrown` or back.

For simplicity, its nice to have the argument be optional on the
`hashbrown` end, which would let the same code compile with either
map.
@Amanieu
Copy link
Member

Amanieu commented Jan 22, 2023

@bors r+

@bors
Copy link
Collaborator

bors commented Jan 22, 2023

📌 Commit c6affc5 has been approved by Amanieu

It is now in the queue for this repository.

@bors
Copy link
Collaborator

bors commented Jan 22, 2023

⌛ Testing commit c6affc5 with merge 7d01f51...

@bors
Copy link
Collaborator

bors commented Jan 22, 2023

☀️ Test successful - checks-actions
Approved by: Amanieu
Pushing 7d01f51 to master...

@bors bors merged commit 7d01f51 into rust-lang:master Jan 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants