For over an iter twice

let iter: Iterator<...> = ...

for x in iter.take(10) {
   ...
}

for y in iter {
}

Here, I want y to iterate over the rest of iter, but can not because it is consumed. Is there a way to make this work? x iterates over first 10 elements, y iterates over the rest.

1 Like
for x in iter.by_ref().take(10) {
   ...
}

for y in iter {
}
5 Likes

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.