zip_eq

Crates.iozip_eq
lib.rszip_eq
version0.1.0
sourcesrc
created_at2022-03-21 12:55:11.491416
updated_at2022-03-21 12:55:11.491416
descriptionZip iterator that check that its inputs have the same length.
homepage
repositoryhttps://github.com/kitegi/zip-eq/
max_upload_size
id554079
size29,086
sarah (sarah-ek)

documentation

README

zip-eq

A zip iterator that checks that its inputs have the same lengths, either eagerly at the moment of construction, or lazily.

Examples

Eager check

use zip_eq::ZipEq;
                                         
let a = [1, 2];
let b = [3, 4];
let mut zipped = a.zip_eq_eager(b); // length check happens here
                                         
assert_eq!(zipped.next(), Some((1, 3)));
assert_eq!(zipped.next(), Some((2, 4)));
assert_eq!(zipped.next(), None);

Lazy check

use zip_eq::ZipEq;
                                         
let a = [1, 2];
let b = [3, 4];
let mut zipped = a.zip_eq_lazy(b);
                                         
assert_eq!(zipped.next(), Some((1, 3)));
assert_eq!(zipped.next(), Some((2, 4)));
assert_eq!(zipped.next(), None); // length check happens here
Commit count: 10

cargo fmt