-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Map::retain #1338
Comments
👍 this would be excellent |
This was implemented for HashMap (but not BTreeMap) in rust-lang/rust#39560. |
Triage, @SimonSapin can/should we perhaps do this for |
The use case I have for this would be to selectively remove elements within a given range — and I'm guessing that's pretty common. Making the interface work for that would be a bit harder than what was implemented for |
@jeffparsons These days we would welcome a PR against https://github.com/rust-lang/rust/ to unstably implement this in the standard library. An RFC would likely be overkill. If you decide to write up such a PR, please cc this issue. :) |
After familiarizing myself with the So... at this point, the things on my mind that more experienced Rust hackers might be able to help answer are:
|
@jeffparsons I typically spam |
There was some incomplete work on BTreeMap/BTreeSet::retain at rust-lang/rust#66747. |
Implement BTreeMap::retain and BTreeSet::retain Adds new methods `BTreeMap::retain` and `BTreeSet::retain`. These are implemented on top of `drain_filter` (rust-lang#70530). The API of these methods is identical to `HashMap::retain` and `HashSet::retain`, which were implemented in rust-lang#39560 and stabilized in rust-lang#36648. The docs and tests are also copied from HashMap/HashSet. The new methods are unstable, behind the `btree_retain` feature gate, with tracking issue rust-lang#79025. See also rust-lang/rfcs#1338.
Implement BTreeMap::retain and BTreeSet::retain Adds new methods `BTreeMap::retain` and `BTreeSet::retain`. These are implemented on top of `drain_filter` (rust-lang#70530). The API of these methods is identical to `HashMap::retain` and `HashSet::retain`, which were implemented in rust-lang#39560 and stabilized in rust-lang#36648. The docs and tests are also copied from HashMap/HashSet. The new methods are unstable, behind the `btree_retain` feature gate, with tracking issue rust-lang#79025. See also rust-lang/rfcs#1338.
Implement BTreeMap::retain and BTreeSet::retain Adds new methods `BTreeMap::retain` and `BTreeSet::retain`. These are implemented on top of `drain_filter` (rust-lang#70530). The API of these methods is identical to `HashMap::retain` and `HashSet::retain`, which were implemented in rust-lang#39560 and stabilized in rust-lang#36648. The docs and tests are also copied from HashMap/HashSet. The new methods are unstable, behind the `btree_retain` feature gate, with tracking issue rust-lang#79025. See also rust-lang/rfcs#1338.
|
Like Vec::retain but for Maps.
retain_hash_collection
) rust#36648)The text was updated successfully, but these errors were encountered: