rust-itertools / itertools

Extra iterator adaptors, iterator methods, free functions, and macros.
https://docs.rs/itertools/
Apache License 2.0
2.72k stars 309 forks source link

Make `Intersperse[With]` lazy #797

Closed Philippe-Cholet closed 11 months ago

Philippe-Cholet commented 11 months ago

Related to #792 To make Intersperse[With] adaptors lazy, I use a nested option which is what core::iter::Peekable uses internally.

EDITs: I certainly hope that it's okay to use a nested option in such case because I did a similar thing to make Product lazy (fixing cartesian_product and iproduct! un-laziness) and make CoalesceBy lazy (fixing 5 methods) that I'll publish once this PR is merged.