1 unstable release

Uses old Rust 2015

0.1.0 Aug 28, 2016

#1577 in Rust patterns

Download history 4430/week @ 2024-03-17 4297/week @ 2024-03-24 4355/week @ 2024-03-31 5136/week @ 2024-04-07 4486/week @ 2024-04-14 4585/week @ 2024-04-21 4664/week @ 2024-04-28 3965/week @ 2024-05-05 4237/week @ 2024-05-12 3737/week @ 2024-05-19 4359/week @ 2024-05-26 4629/week @ 2024-06-02 4582/week @ 2024-06-09 3840/week @ 2024-06-16 2986/week @ 2024-06-23 1289/week @ 2024-06-30

12,854 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