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

Tracking Issue for {BTreeMap,BTreeSet}::retain #79025

Closed
2 of 4 tasks
Tracked by #16
mbrubeck opened this issue Nov 13, 2020 · 4 comments · Fixed by #84121
Closed
2 of 4 tasks
Tracked by #16

Tracking Issue for {BTreeMap,BTreeSet}::retain #79025

mbrubeck opened this issue Nov 13, 2020 · 4 comments · Fixed by #84121
Labels
A-collections Area: `std::collection` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.

Comments

@mbrubeck
Copy link
Contributor

mbrubeck commented Nov 13, 2020

This is a tracking issue for BTreeMap::retain and BTreeSet::retain (part of rust-lang/rfcs#1338).
The feature gate for the issue is #![feature(btree_retain)].

Unstable API

impl<T: Ord> BTreeSet<T> {
    pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&T) -> bool;
}

impl<K: Ord, V> BTreeMap<K, V> {
    pub fn retain<F>(&mut self, mut f: F) where F: FnMut(&K, &mut V) -> bool;
}

Steps

  • Implement the RFC
  • FCP
  • Adjust documentation
  • Stabilization PR

Unresolved Questions

  • Is the performance of the current implementation (based on drain_filter) good enough to be useful? Concern raised in this comment.

Implementation history

@mbrubeck mbrubeck added the C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. label Nov 13, 2020
@jonas-schievink jonas-schievink added A-collections Area: `std::collection` T-libs-api Relevant to the library API team, which will review and decide on the PR/issue. labels Nov 13, 2020
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 13, 2020
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.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 13, 2020
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.
Dylan-DPC-zz pushed a commit to Dylan-DPC-zz/rust that referenced this issue Nov 14, 2020
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.
@KodrAus KodrAus added the Libs-Tracked Libs issues that are tracked on the team's project board. label Dec 16, 2020
@joshtriplett
Copy link
Member

We discussed this in today's @rust-lang/libs meeting. We'd like to see a comment added documenting the performance characteristics of this (as well as a corresponding update to drain_filter), and suggesting that this might not be what you want if you're removing a substantial number of elements.

Beyond that documentation, though, we'd be happy to see this stable.

@rfcbot merge

@rfcbot
Copy link

rfcbot commented Mar 31, 2021

Team member @joshtriplett has proposed to merge this. The next step is review by the rest of the tagged team members:

No concerns currently listed.

Once a majority of reviewers approve (and at most 2 approvals are outstanding), this will enter its final comment period. If you spot a major issue that hasn't been raised at any point in this process, please speak up!

See this document for info about what commands tagged team members can give me.

@rfcbot rfcbot added proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. and removed proposed-final-comment-period Proposed to merge/close by relevant subteam, see T-<team> label. Will enter FCP once signed off. labels Mar 31, 2021
@rfcbot
Copy link

rfcbot commented Mar 31, 2021

🔔 This is now entering its final comment period, as per the review above. 🔔

@rfcbot rfcbot added finished-final-comment-period The final comment period is finished for this PR / Issue. to-announce Announce this issue on triage meeting and removed final-comment-period In the final comment period and will be merged soon unless new substantive objections are raised. labels Apr 10, 2021
@rfcbot
Copy link

rfcbot commented Apr 10, 2021

The final comment period, with a disposition to merge, as per the review above, is now complete.

As the automated representative of the governance process, I would like to thank the author for their work and everyone else who contributed.

The RFC will be merged soon.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-collections Area: `std::collection` C-tracking-issue Category: A tracking issue for an RFC or an unstable feature. disposition-merge This issue / PR is in PFCP or FCP with a disposition to merge it. finished-final-comment-period The final comment period is finished for this PR / Issue. Libs-Tracked Libs issues that are tracked on the team's project board. T-libs-api Relevant to the library API team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants