Skip to content

Commit 11d36ae

Browse files
author
Rob Speer
committed
iterator docs: Move paragraph about discarding; clarify "consumed"
1 parent ebf29ef commit 11d36ae

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

src/libcore/iter/iterator.rs

+5-5
Original file line numberDiff line numberDiff line change
@@ -209,14 +209,14 @@ pub trait Iterator {
209209

210210
/// Returns the `n`th element of the iterator.
211211
///
212-
/// Note that all preceding elements, as well as the returned element, will be
213-
/// consumed. That means that the preceding elements will be discarded, and also
214-
/// that calling `nth(0)` multiple times on the same iterator will return different
215-
/// elements.
216-
///
217212
/// Like most indexing operations, the count starts from zero, so `nth(0)`
218213
/// returns the first value, `nth(1)` the second, and so on.
219214
///
215+
/// Note that all preceding elements, as well as the returned element, will be
216+
/// consumed from the iterator. That means that the preceding elements will be
217+
/// discarded, and also that calling `nth(0)` multiple times on the same iterator
218+
/// will return different elements.
219+
///
220220
/// `nth()` will return [`None`] if `n` is greater than or equal to the length of the
221221
/// iterator.
222222
///

0 commit comments

Comments
 (0)