#repeat #iterator #repeating

yanked repeat

Repeats an iterator

Uses old Rust 2015

0.1.0 May 12, 2018

#5 in #repeating

MIT license

3KB

Repeat

A crate for repeating an iterator.

Unlike Iterator::cycle() in the standard library, repeat iterator stops repeating after a certain count.

Example

/// /// use repeat::Repeat; /// let mut iter = Repeat::new([1, 2, 3, 4, 5].iter(), 2); /// assert_eq!(iter.next().unwrap().as_slice(), &[1, 2, 3, 4, 5]); /// assert_eq!(iter.next().unwrap().as_slice(), &[1, 2, 3, 4, 5]); ///

No runtime deps