or-iterator

Crates.ioor-iterator
lib.rsor-iterator
version0.1.1
sourcesrc
created_at2020-05-02 14:28:19.440208
updated_at2020-05-02 14:45:15.75436
descriptionRust iterator which takes two iterators and returns non-empty one
homepage
repositoryhttps://github.com/panarch/or-iterator
max_upload_size
id236581
size9,734
Taehoon Moon (panarch)

documentation

README

or-iterator

Crates.io docs.rs License

Rust iterator which takes two iterators and return not empty one

use or_iterator::OrIterator;

let v1 = vec![1, 2, 3];
let v2 = vec![4, 5];
let or = v1.iter().or(v2.iter());
assert_eq!(3, or.count());

let v1 = vec![];
let v2 = vec![4, 5];
let or = v1.iter().or(v2.iter());
assert_eq!(2, or.count());

Thanks to

Frank Steffahn (https://internals.rust-lang.org/u/steffahn)

Commit count: 10

cargo fmt