rust-lang / rust-lang/hashbrown
get_many_mut with variable number of keys
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 3k
- Forks
- 358
- Avg merge
- 11h 57m
- Merged PRs (30d)
- 2
Description
get_many_mut on slices (https://github.com/rust-lang/rust/pull/83608) does not need to handle a variable number of keys (although it might be nice) because, worse case scenario, you can sort your input array of indexes and iterate over it with successive split_at_mut.
In this case however, that's not an option, as HashMaps don't have the equivalent of split_at_mut.
So it may be useful to be able to lookup a variable (somewhat large) number of distinct keys at the same time in a HashMap, and get mutable references back.
That is in particular needed when we have a storage of many entries, and we want to run a round of updates on distinct subsets of keys, and want to run these in parallel.
Having get_many_mut follow a similar model to what is described at https://github.com/rust-lang/rust/pull/83608#pullrequestreview-966536956 and providing an interface that allows for this would consequently be useful - in fact, that is something I currently would use.
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the get_many_mut interface discussed in Rust PR 83608 and compare its slice-based model with HashMap access in hashbrown. Define how a variable, somewhat large number of distinct keys should yield mutable references and support parallel updates; the issue does not name a file or test to run.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- backend
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100