Add Iterator comparison methods that take a comparison function by timvermeulen · Pull Request #62205 · rust-lang/rust (original) (raw)

Conversation

This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.Learn more about bidirectional Unicode characters

[ Show hidden characters]({{ revealButtonHref }})

timvermeulen

@rustbot rustbot added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-waiting-on-review

Status: Awaiting review from the assignee but also interested parties.

labels

Jul 30, 2019

@rustbot rustbot added S-inactive

Status: Inactive and waiting on the author. This is often applied to closed PRs.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Aug 6, 2019

@KodrAus KodrAus added S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

and removed S-inactive

Status: Inactive and waiting on the author. This is often applied to closed PRs.

labels

Aug 25, 2019

@timvermeulen

@bors bors added S-waiting-on-bors

Status: Waiting on bors to run and complete tests. Bors will change the label on completion.

and removed S-waiting-on-author

Status: This is awaiting some action (such as code changes or more information) from the author.

labels

Sep 8, 2019

Centril added a commit to Centril/rust that referenced this pull request

Sep 8, 2019

@Centril

Add Iterator comparison methods that take a comparison function

This PR adds Iterator::{cmp_by, partial_cmp_by, eq_by, ne_by, lt_by, le_by, gt_by, ge_by}. We already have Iterator::{cmp, partial_cmp, ...} which are less general (but not any simpler) than the ones I'm proposing here.

I'm submitting this PR now because rust-lang#61505 has been merged, so this change should not have a noticeable effect on the Iterator docs page size.

The diff is quite messy, here's what I changed:

The corresponding _by_key methods aren't included because they're not as fundamental as the _by methods and can easily be implemented in terms of them. Is that reasonable, or would adding the _by_key methods be desirable for the sake of completeness?

I didn't add any tests – I couldn't think of any that weren't already covered by our existing tests. Let me know if there's a particular test that would be useful to add.

bors added a commit that referenced this pull request

Sep 8, 2019

@bors

Rollup of 4 pull requests

Successful merges:

Failed merges:

r? @ghost

Centril added a commit to Centril/rust that referenced this pull request

Sep 23, 2019

@Centril

Document the unstable iter_order_by library feature

Tracking issue: rust-lang#64295

Follow-up for: rust-lang#62205

References the tracking issue and adds a page to the unstable book for the new unstable iter_order_by feature.

Centril added a commit to Centril/rust that referenced this pull request

Sep 24, 2019

@Centril

Document the unstable iter_order_by library feature

Tracking issue: rust-lang#64295

Follow-up for: rust-lang#62205

References the tracking issue and adds a page to the unstable book for the new unstable iter_order_by feature.

Centril added a commit to Centril/rust that referenced this pull request

Sep 24, 2019

@Centril

Document the unstable iter_order_by library feature

Tracking issue: rust-lang#64295

Follow-up for: rust-lang#62205

References the tracking issue and adds a page to the unstable book for the new unstable iter_order_by feature.