1 unstable release

Uses old Rust 2015

0.1.0 Aug 28, 2016

#27 in #predicate

Download history 2741/week @ 2024-11-17 1828/week @ 2024-11-24 2737/week @ 2024-12-01 1957/week @ 2024-12-08 2204/week @ 2024-12-15 724/week @ 2024-12-22 829/week @ 2024-12-29 2419/week @ 2025-01-05 2382/week @ 2025-01-12 2944/week @ 2025-01-19 2798/week @ 2025-01-26 2700/week @ 2025-02-02 3040/week @ 2025-02-09 2739/week @ 2025-02-16 2847/week @ 2025-02-23 2007/week @ 2025-03-02

10,909 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