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}::drain #81074

Open
3 tasks
ssomers opened this issue Jan 16, 2021 · 2 comments
Open
3 tasks

Tracking Issue for {BTreeMap,BTreeSet}::drain #81074

ssomers opened this issue Jan 16, 2021 · 2 comments
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC

Comments

@ssomers
Copy link
Contributor

ssomers commented Jan 16, 2021

This is a tracking issue for a range-based drain method on BTreeMap and BTreeSet, similar to the one in Vec.
The feature gate for the issue is #![feature(btree_drain)].

About tracking issues

Tracking issues are used to record the overall progress of implementation.
They are also used as hubs connecting to other relevant issues, e.g., bugs or open design questions.
A tracking issue is however not meant for large scale discussion, questions, or bug reports about a feature.
Instead, open a dedicated issue for the specific matter and add the relevant feature gate label.

Steps

Unresolved Questions

  • Is plain drain the right name for a range-based function? It's equivalent to Vec::drain if you consider a Vec<T> to be a BTreeMap<usize, T> with consecutive keys. It's not equivalent to the HashMap::drain() without argument, and BTreeMap::drain(..) doesn't compile without a type annotation if the key type has additional Borrow implementations, whereas Vec::drain(..) is always a simple way to drain everything.
  • An efficient implementation of draining implies most of the drained key-value pairs are in entirely preserved (and not even visited) subtrees. Therefore, the return value can be relatively easily adapted to obtain a range-based method much like split_off. Is it OK to add split_off_range along the way?

Implementation history

@ssomers ssomers added the C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC label Jan 16, 2021
@ssomers
Copy link
Contributor Author

ssomers commented Jan 16, 2021

@rustbot modify labels: +S-A-collections +S-B-unstable +S-C-tracking-issue +S-Libs-Tracked +S-T-libs

@JohnTitor
Copy link
Member

@ssomers The implementation PR has been closed, do you want to follow up or could we close this tracking issue for now?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
C-tracking-issue Category: An issue tracking the progress of sth. like the implementation of an RFC
Projects
None yet
Development

No branches or pull requests

2 participants