for iterators in @rustlang does s.chars().cycle().nth(absurdly_high_number) allocate for every number up to absurdly_high_number? or is it smart enough to pick the value in the cycle that would be at that position?
4
2
17
Currently I imagine it's not efficient, though with specialisation perhaps the Cycle struct could have an impl for .nth() if you're cycling an exact length iterator to compute the offset?

Dec 3, 2020 ยท 11:04 PM UTC

1
1
Chars can't be an ExactLenthIterator though, can it?
1
1