#zip #iterator #second #optional #irc #ends #tuple

try_zip

Zip with a shorter or optional second iterator

3 unstable releases

0.2.1 May 18, 2024
0.2.0 May 18, 2024
0.1.0 Apr 19, 2024

#302 in Compression

Download history 1/week @ 2024-07-29 18/week @ 2024-09-23

72 downloads per month

0BSD license

4KB
63 lines

try_zip

A variant of zip that can handle a shorter/optional second iterator.

Given (0..10).zip(0..5), zip would stop after the shorter iterator 0..5 ends.

(0..10).try_zip(Some(0..5)), however, will continue, using None for the second value of the tuple. (The tuple returned by TryZip is of the type (A::Item, Option<B::Item>))

This crate was written for easily parsing IRC join messages.

No runtime deps