rayon::iter

Function repeatn

Source
pub fn repeatn<T: Clone + Send>(elt: T, n: usize) -> RepeatN<T>
Expand description

Creates a parallel iterator that produces n repeats of elt (by cloning it).

ยงExamples

use rayon::prelude::*;
use rayon::iter::repeatn;
let x: Vec<(i32, i32)> = repeatn(22, 3).zip(0..3).collect();
assert_eq!(x, vec![(22, 0), (22, 1), (22, 2)]);