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

Implement partition_result #511

Merged
merged 1 commit into from Jan 16, 2021
Merged

Conversation

mingyli
Copy link
Contributor

@mingyli mingyli commented Jan 1, 2021

Addresses #510

partition_result behaves as OCaml Base's partition_result does:

use itertools::Itertools;

let successes_and_failures = vec![Ok(1), Err(false), Err(true), Ok(2)];

let (successes, failures): (Vec<_>, Vec<_>) = successes_and_failures
    .into_iter()
    .partition_result();

assert_eq!(successes, [1, 2]);
assert_eq!(failures, [false, true]);

@jswrenn jswrenn added this to the next milestone Jan 16, 2021
Copy link
Member

@jswrenn jswrenn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this!

bors r+

@bors
Copy link
Contributor

bors bot commented Jan 16, 2021

Build succeeded:

@bors bors bot merged commit 2d52ca2 into rust-itertools:master Jan 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants