Crates.io | repeat |
lib.rs | repeat |
version | 0.1.0 |
source | src |
created_at | 2018-05-12 13:35:46.490082 |
updated_at | 2018-05-12 13:35:46.490082 |
description | Repeats an iterator. |
homepage | |
repository | https://github.com/thelearnerofcode/repeat |
max_upload_size | |
id | 65053 |
size | 2,532 |
A crate for repeating an iterator.
Unlike Iterator::cycle() in the standard library, repeat iterator stops repeating after a certain count.
/// /// 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]); ///