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
WIP Add Set entry API #120077
base: master
Are you sure you want to change the base?
WIP Add Set entry API #120077
Conversation
r? @thomcc (rustbot has picked a reviewer for you, use r? to override) |
T: Hash, | ||
S: BuildHasher, | ||
{ | ||
todo!() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
See what @Amanieu thinks as the hashbrown
maintainer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would prefer that is be added as a public API in hashbrown too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What would be the difference between insert
and insert_entry
? It kind of seems to me like those are the same API? Please correct me if I'm wrong, but otherwise I'd propose deprecating insert
and making insert_entry
public in hashbrown and then just having insert_entry -> OccupiedEntry
in the stdlib.
https://doc.rust-lang.org/std/collections/hash_map/struct.VacantEntry.html#method.insert
The hashmap needs both insert
and insert_entry
because one returns a reference to the value while the other to the entry. But for hashset there is no value, so we don't need insert at all.
Thoughts?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Amanieu thoughts on the API changes I proposed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we could just change insert
to always return an OccupiedEntry
and remove insert_entry
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wouldn't that be a breaking change for hashbrown? But yeah it'd be ideal.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's fine to make breaking changes to hashbrown, it just means that a major version bump is needed.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sounds good, done! rust-lang/hashbrown#495
This comment has been minimized.
This comment has been minimized.
I assume the PR title is wrong here? This is adding |
Oops, thanks. Rebase error. |
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
This comment has been minimized.
Signed-off-by: Alex Saveau <saveau.alexandre@gmail.com>
The job Click to see the possible cause of the failure (guessed by this bot)
|
I'm going to be away for a few months, so I'm rerolling my PRs so that folks don't have to wait for me. Sorry/thanks. r? libs |
Removing this from my review queue while you're waiting for hashbrown... @rustbot author |
Make HashSet::insert return OccupiedEntry See rust-lang/rust#120077 (comment)
@SUPERCILEX any updates on this? thanks |
@Dylan-DPC the hashbrown PR was merged. @Amanieu What are the next steps? |
See https://rust-lang.zulipchat.com/#narrow/stream/219381-t-libs/topic/HashSet.3A.3Aentry/near/413224639 and #60896 (comment)
Closes rust-lang/rfcs#1490