In rust, how do I iterate all over the all but the last n
elements?
[0, 1, 2, 3, 4].iter().???(n)
Similar but not the same as Use all but the last element from an iterator which is actually about matching chunk sizes. The content of that Question is "To be sure that all parts have equal length, I just want to drop that last element and then call map() on what's left.". All the proceeding answers use variations of chunk
in their sample code. Reviewing those code samples, I found them too difficult to apply to my needs. Hence this new question with my Answer that does not use chunk
.