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

immutable access to RawTable? #403

Open
tower120 opened this issue Feb 22, 2023 · 6 comments
Open

immutable access to RawTable? #403

tower120 opened this issue Feb 22, 2023 · 6 comments

Comments

@tower120
Copy link
Contributor

Why there is no immutable access to RawTable both in HashMap and HashSet?

For example, I want to emulate absent HashSet::raw_entry().from_hash... with HashSet::raw_table().get()
but there is only mutable access to underlying RawTable in both HashSet and HashMap.

And is there a reason why there is no raw_entry API for HashSet?

@Amanieu
Copy link
Member

Amanieu commented Feb 22, 2023

This is an oversight. We should probably have both raw_table and raw_table_mut methods.

There is no raw_entry API for HashSet simply because nobody has implemented one yet. But then again there are concerns about the raw entry API and whether we should keep it at all.

@tower120
Copy link
Contributor Author

OK. I can implement raw_table + raw_table_mut and PR it - that's not problem.

Wouldn't it be a breaking change?
Maybe something like raw_table_immut instead?

@Amanieu
Copy link
Member

Amanieu commented Feb 22, 2023

The raw API isn't very stable, it's fine to make breaking changes. We'll just make another major version bump.

@tower120
Copy link
Contributor Author

So can I do it now? Will you review/accept that PR?

@Amanieu
Copy link
Member

Amanieu commented Feb 22, 2023

Yes, but it may take a while until we actually publish a new release. I want to get all of the breaking changes in at once.

@tower120
Copy link
Contributor Author

OK - sure. I'm starting the implementation.

bors added a commit that referenced this issue Feb 23, 2023
raw_table + raw_table_mut

Immutable access to `RawTable` from both `HashMap` and `HashSet`.

Implements #403
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

No branches or pull requests

2 participants