drain-while 0.1.0

A draining iterator which stops when a predicate becomes false
Documentation
  • Coverage
  • 75%
    3 out of 4 items documented2 out of 4 items with examples
  • Size
  • Source code size: 17.52 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 451.43 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • asayers/drain-while
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • asayers

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.