Expand description
Zip an iterator to a repeately cloned object.
Pass an owned object that implements Clone
to create an iterator that zips
the original iterator with clones of the object.
One iteration returns the original object, thus using one fewer clones than
the otherwise equivalent iter.zip(repeat_with(|| cloned.clone()))
.
Example:
use zip_clone::ZipClone;
let s = String::from("Hello");
let iter = 0..10;
for (i, s) in iter.zip_clone(s) {
assert_eq!(s, String::from("Hello"));
}
Structs§
Traits§
- ZipClone
- Trait to zip an iterator to a repeately cloned object.
Functions§
- zip_
clone - Zip an iterator to a repeately cloned object.