TL;DR: from the documentation of
Iteratror::nth itself: "
nth(0) returns the first value,
nth(1) the second, and so on". If this is not a foot-shooter, what is?
As we know, Rust consistently uses 0-based indexing in arrays, slices and iterators. While many beginners struggle with this at first, there are very good reason to use 0-based indexing, and even better reasons to be consistent about that.
Having a method for skipping to an arbitrary element of an iterator is a good idea. And having this method use the same convention as other methods, 0-based indexing, is also good. But the name of this method should not give the impression that it uses a different convention (even if the documentation is clear about it).
Some people have already objected to me that developers are used to count from zero (with which I agre), and that the first ("1th") element comes after the 0th element. I disagree with this last point, and apparently, so do the designers of the standard library. See the documentation of
Iterator::nth quoted above. See also the fact that
My ideal solution would be to eventually deprecate
nth and replace it with an identical method having a less confusing name, e.g.