I'm starting to experiment with the Rayon crate and I'm sure I must be missing something obvious here. If I call par_iter to get one of Rayon's parallel iterators, I can call the usual iterator methods on it (for_each, map, collect...) so it seems to be an iterator. But when I try to use it in a for loop, the compiler insists it is not:
error[E0277]: rayon::range::Iter<{integer}> is not an iterator
So indeed, despite the name a ParallelIterator is in fact not an Iterator! If you want to turn it back into a normal Iterator, I guess you have to collect() it into a Vec or something like that?
It's actually a ParallelIterator, which is deliberately similar to Iterator, although some methods are a bit different to support parallel execution. For example, Iterator::map requires only FnMut while ParallelIterator::map requires Fn + Sync + Send.