Function lit_vek::cycle_n

source ·
pub fn cycle_n<I: IntoIterator>(it: I, n: usize) -> CycleN<I::IntoIter> where
    I::IntoIter: Clone,
Expand description

Iterator adaptor that repeats a sequence n times.

use lit_vek::cycle_n;

assert!(cycle_n([1, 2, 3], 2).eq([1, 2, 3, 1, 2, 3]));

The sequence must be IntoIter, and the iterator must be Clone.

This is mostly to enable the vek![...elems, n] syntax.