Crate split_iter [−] [src]
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]); }
Structs
Split |
One of a pair of iterators. One returns the items for which the predicate
returns |
Traits
Splittable |
Provides an iterator adaptor method that splits an iterator into two iterators according to a predicate. |