#How do you "restart" an iterator after reaching the end of the iterator?
7 messages · Page 1 of 1 (latest)
A trait for dealing with iterators.
?eval [1,2,3].into_iter().cycle().take(20).collect::<Vec<_>>()
[1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2, 3, 1, 2]```
Ill try it in what im doing
this keeps returning RED, the iterator isn't advancing?
let mut vertex_colors = [Color::RED, Color::GREEN, Color::BLUE].iter().cycle();
println!("vertex color is {:#?}", vertex_colors.next().unwrap());
You only called next once