1 unstable release

Uses old Rust 2015

0.1.0 Aug 28, 2016

#1030 in Rust patterns

Download history 5715/week @ 2022-08-14 3531/week @ 2022-08-21 7252/week @ 2022-08-28 5787/week @ 2022-09-04 6017/week @ 2022-09-11 4114/week @ 2022-09-18 3738/week @ 2022-09-25 2664/week @ 2022-10-02 3570/week @ 2022-10-09 2261/week @ 2022-10-16 4848/week @ 2022-10-23 3448/week @ 2022-10-30 4451/week @ 2022-11-06 2901/week @ 2022-11-13 3344/week @ 2022-11-20 3577/week @ 2022-11-27

14,414 downloads per month
Used in 3 crates (2 directly)

MIT license

6KB
112 lines

split-iter Build Status

Provides the trait Splittable, which allows you to split an iterator according to a predicate.

Documentation

Usage

Add to your Cargo.toml:

[dependencies]
split-iter = "0.1"

Example

extern crate split_iter;
use split_iter::Splittable;

fn main() {
	let (odd, even) = (1..10).split(|v| v % 2 == 0);

	assert_eq!(odd.collect::<Vec<_>>(), [1,3,5,7,9]);
	assert_eq!(even.collect::<Vec<_>>(), [2,4,6,8]);
}

lib.rs:

Provides the trait Splittable, which allows you to split an iterator according to a predicate.

Example

use split_iter::Splittable;

fn main() {
	let (odd, even) = (1..10).split(|v| v % 2 == 0);

	assert_eq!(odd.collect::<Vec<_>>(), [1,3,5,7,9]);
	assert_eq!(even.collect::<Vec<_>>(), [2,4,6,8]);
}

No runtime deps