Uh oh!
There was an error while loading. Please reload this page.
proposal for BTreeMap/Set min/max, #62924 - #65637
Conversation
rust-highfive
commented
Oct 20, 2019
r? @kennytm (rust_highfive has picked a reviewer for you, use r? to override) |
Centril
commented
Oct 20, 2019
scottmcm
commented
Oct 21, 2019
Hmm, Slightly crazy idea: |
Uh oh!
There was an error while loading. Please reload this page.
ssomers
commented
Oct 21, 2019
I'm definitely crazy about |
ssomers
commented
Oct 22, 2019
Restrain myself? I'll leave that up to others. Let's pop ahead of HashMap users and make BTreeSet even faster than it already is! |
There was a problem hiding this comment.
| /// The first value is always the minmumn value in the set. | |
| /// The first value is always the minimum value in the set. |
I noticed that in my 2nd commit, but also in the earliest documentation commit 21ac985, some of the descriptions of BTreeSet mention "element" and some "value" for the thingies contained. I settled on "value" for the new functions because that seems most popular (8 against 6, discarding similar descriptions and those I contributed). Also, a little more proper unit testing (separate from doc tests). |
bluss
commented
Oct 30, 2019
I'm sorry, I haven't had time to review, still expect to do it, but don't mind someone else jumping in. |
Here are some arguments for and against the immutable variants:
For and against the mutable variants:
|
bluss
commented
Nov 6, 2019
@Centril can I reassign this? I won't have the time unfortunately |
Centril
commented
Nov 6, 2019
Sure, let's try r? @scottmcm |
scottmcm
commented
Nov 12, 2019
These seems plausible and the implementations look fine. I think it's ok for them to get checked in, and then libs can decide later if they're worth stabilizing or should be removed. @bors r+ |
bors
commented
Nov 12, 2019
📌 Commit ffeac1f has been approved by |
bors
commented
Nov 13, 2019
proposal for BTreeMap/Set min/max, #62924 - Which pair of names: #62924 lists the existing possibilities min/max, first/last, (EDIT) front/back, peek(/peek_back?). Iterators have next/next_back or next/last. I'm slightly in favour of first/last because min/max might suggest they search over the entire map, and front/back pretends they are only about position. - Return key only instead of pair like iterator does? - If not, then keep the _key_value suffix? ~~Also provide variant with mutable value? But there is no such variant for get_key_value.~~ - Look for and upgrade more usages of `.iter().next()` and such in the libraries? I only upgraded the ones I contributed myself, all very recently.
bors
commented
Nov 13, 2019
☀️ Test successful - checks-azure |
BTreeMap first last proposal tweaks Clean-up and following up on a request in rust-lang#62924. Trying the reviewer of the original code rust-lang#65637... r? @scottmcm
BTreeMap first last proposal tweaks Clean-up and following up on a request in rust-lang#62924. Trying the reviewer of the original code rust-lang#65637... r? @scottmcm
Also provide variant with mutable value? But there is no such variant for get_key_value..iter().next()and such in the libraries? I only upgraded the ones I contributed myself, all very recently.