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

Adding function for getting access to map table: RawTable<(K, V), A> field #335

Merged
merged 4 commits into from May 17, 2022

Conversation

JustForFun88
Copy link
Contributor

@JustForFun88 JustForFun88 commented May 15, 2022

I was a little interested in issues "API for removing by key hash and value" #330. The original question was about adding a fancy API, and of course it wasn't merged (#334).

However, it seems to me that this shows that it would be nice to just add the ability to access to map's fields. And let the user himself do what he pleases.

The user will still not be able to change the existing API. But at the same time, he will have the opportunity to add small extensions. Otherwise, when using RawTable, he will have to not only add one or two functions, but generally recreate all the HashMap’s APIs, which can be difficult.

@JustForFun88
Copy link
Contributor Author

JustForFun88 commented May 15, 2022

I understood. It's not my fault. It is rust-lang/rust#96150. Open pull request

@Amanieu
Copy link
Member

Amanieu commented May 16, 2022

Could you expose these using functions instead? The hash builder is already exposed via the hasher() method, so you'd just need to add an unsafe raw_table(_mut) method which exposes the underlying raw table. I don't think that a separate feature is needed, you can include it under the existing raw feature.

@JustForFun88 JustForFun88 changed the title Adding map-inner feature for getting access to map fields Adding function for getting access to map table: RawTable<(K, V), A> field May 17, 2022
@JustForFun88
Copy link
Contributor Author

Could you expose these using functions instead? The hash builder is already exposed via the hasher() method, so you'd just need to add an unsafe raw_table(_mut) method which exposes the underlying raw table. I don't think that a separate feature is needed, you can include it under the existing raw feature.

Ready. Fixed as requested.

@JustForFun88 JustForFun88 changed the title Adding function for getting access to map table: RawTable<(K, V), A> field [WIP] Adding function for getting access to map table: RawTable<(K, V), A> field May 17, 2022
@JustForFun88 JustForFun88 changed the title [WIP] Adding function for getting access to map table: RawTable<(K, V), A> field Adding function for getting access to map table: RawTable<(K, V), A> field May 17, 2022
@Amanieu
Copy link
Member

Amanieu commented May 17, 2022

@bors r+

@bors
Copy link
Collaborator

bors commented May 17, 2022

📌 Commit c773eb2 has been approved by Amanieu

@bors
Copy link
Collaborator

bors commented May 17, 2022

⌛ Testing commit c773eb2 with merge f3a9f21...

@bors
Copy link
Collaborator

bors commented May 17, 2022

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

@bors bors merged commit f3a9f21 into rust-lang:master May 17, 2022
@JustForFun88 JustForFun88 deleted the pub_map_inner branch May 18, 2022 02:23
braddunbar added a commit to braddunbar/hashbrown that referenced this pull request Sep 3, 2022
Just like rust-lang#335 did for `HashMap`, I'd like to add access to the
underlying `RawTable` for `HashSet`. I intend to use it in conjunction
with rust-lang#354 to pull random elements from a `HashSet`.
@braddunbar braddunbar mentioned this pull request Sep 3, 2022
braddunbar added a commit to braddunbar/hashbrown that referenced this pull request Sep 3, 2022
Just like rust-lang#335 did for `HashMap`, I'd like to add access to the
underlying `RawTable` for `HashSet`. I intend to use it in conjunction
with rust-lang#354 to pull random elements from a `HashSet`.
braddunbar added a commit to braddunbar/hashbrown that referenced this pull request Sep 3, 2022
Just like rust-lang#335 did for `HashMap`, I'd like to add access to the
underlying `RawTable` for `HashSet`. I intend to use it in conjunction
with rust-lang#354 to pull random elements from a `HashSet`.
bors added a commit that referenced this pull request Sep 8, 2022
Add HashSet#raw_table

Just like #335 did for `HashMap`, I'd like to add access to the underlying `RawTable` for `HashSet`. I intend to use it in conjunction with #354 to pull random elements from a `HashSet`.

Let me know if I've missed something here or you'd like things implemented differently. I'll be happy to change it up!
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