split-iter

Crates.iosplit-iter
lib.rssplit-iter
version0.1.0
sourcesrc
created_at2016-08-28 21:28:59.768585
updated_at2016-08-28 21:28:59.768585
descriptionAllows splitting of iterators.
homepage
repositoryhttps://github.com/Mixthos/split-iter
max_upload_size
id6162
size6,717
Georg Echterling (Mixthos)

documentation

http://mixthos.github.com/split-iter

README

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]);
}
Commit count: 3

cargo fmt