drain-while

Crates.iodrain-while
lib.rsdrain-while
version0.1.0
sourcesrc
created_at2017-06-28 07:09:29.373889
updated_at2017-06-28 07:09:29.373889
descriptionA draining iterator which stops when a predicate becomes false
homepage
repositoryhttps://github.com/asayers/drain-while
max_upload_size
id21074
size17,527
CI (github:colearn-dev:ci)

documentation

https://docs.rs/drain-while/

README

A draining Iterator which stops when a predicate becomes false.

use drain_while::*;

let mut original = vec![1,2,3,4,5];
let mut matching = vec![];

for x in original.drain_while(|x| *x < 3) {
    matching.push(x);
}

assert_eq!(matching, vec![1,2]);
assert_eq!(original, vec![3,4,5]);

License

Licensed under either of

at your option.

Contribution

Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in the work by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.

Commit count: 11

cargo fmt