Function streaming_iterator::repeat

source ·
pub fn repeat<T>(item: T) -> Repeat<T>
Expand description

Creates an iterator that returns an item endlessly.

let mut streaming_iter = streaming_iterator::repeat(1);
assert_eq!(streaming_iter.next(), Some(&1));
assert_eq!(streaming_iter.next(), Some(&1));
assert_eq!(streaming_iter.next(), Some(&1));
assert_eq!(streaming_iter.next(), Some(&1));
assert_eq!(streaming_iter.next(), Some(&1));
// ...