1
Fork 0

Rollup merge of #61237 - DevQps:expand-iterator-docs, r=Mark-Simulacrum

Updated the Iterator docs with information about overriding methods.

# Description

Updated the Iterator docs with information about overriding methods.

closes #60223
This commit is contained in:
Mazdak Farrokhzad 2019-05-28 11:49:00 +02:00 committed by GitHub
commit a449bc3ad0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 6 additions and 0 deletions

View file

@ -140,6 +140,11 @@
//! call `next()` on your iterator, until it reaches `None`. Let's go over that
//! next.
//!
//! Also note that `Iterator` provides a default implementation of methods such as `nth` and `fold`
//! which call `next` internally. However, it is also possible to write a custom implementation of
//! methods like `nth` and `fold` if an iterator can compute them more efficiently without calling
//! `next`.
//!
//! # for Loops and IntoIterator
//!
//! Rust's `for` loop syntax is actually sugar for iterators. Here's a basic

View file

@ -964,6 +964,7 @@ pub trait Iterator {
/// Creates an iterator that skips the first `n` elements.
///
/// After they have been consumed, the rest of the elements are yielded.
/// Rather than overriding this method directly, instead override the `nth` method.
///
/// # Examples
///