1 unstable release

Uses old Rust 2015

0.1.0 Aug 28, 2016

#1444 in Rust patterns

Download history 3144/week @ 2023-12-14 2892/week @ 2023-12-21 2132/week @ 2023-12-28 3597/week @ 2024-01-04 4227/week @ 2024-01-11 4751/week @ 2024-01-18 3595/week @ 2024-01-25 2970/week @ 2024-02-01 3865/week @ 2024-02-08 3553/week @ 2024-02-15 4601/week @ 2024-02-22 4155/week @ 2024-02-29 4112/week @ 2024-03-07 4525/week @ 2024-03-14 4280/week @ 2024-03-21 3074/week @ 2024-03-28

16,794 downloads per month
Used in 5 crates (3 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