diff options
| author | bors <bors@rust-lang.org> | 2016-04-17 09:09:24 -0700 |
|---|---|---|
| committer | bors <bors@rust-lang.org> | 2016-04-17 09:09:24 -0700 |
| commit | aa5888717f48444aac7a3f849b33a2f70feda1d8 (patch) | |
| tree | 6a692db6ee52703e208ad79323b9bb393d406959 /src | |
| parent | a6264002637f60322d17329eaf4a25b9abe2c638 (diff) | |
| parent | c29585ca5b8cd723dc7cb66fa192a329906582d9 (diff) | |
| download | rust-aa5888717f48444aac7a3f849b33a2f70feda1d8.tar.gz rust-aa5888717f48444aac7a3f849b33a2f70feda1d8.zip | |
Auto merge of #33016 - tbu-:pr_doc_peekable, r=alexcrichton
Add a note about side effects for "peekable" iterators
Diffstat (limited to 'src')
| -rw-r--r-- | src/libcore/iter.rs | 9 |
1 files changed, 7 insertions, 2 deletions
diff --git a/src/libcore/iter.rs b/src/libcore/iter.rs index b4378a5fec5..69f10d197f7 100644 --- a/src/libcore/iter.rs +++ b/src/libcore/iter.rs @@ -901,12 +901,17 @@ pub trait Iterator { Enumerate { iter: self, count: 0 } } - /// Creates an iterator which can look at the `next()` element without - /// consuming it. + /// Creates an iterator which can use `peek` to look at the next element of + /// the iterator without consuming it. /// /// Adds a [`peek()`] method to an iterator. See its documentation for /// more information. /// + /// Note that the underlying iterator is still advanced when `peek` is + /// called for the first time: In order to retrieve the next element, + /// `next` is called on the underlying iterator, hence any side effects of + /// the `next` method will occur. + /// /// [`peek()`]: struct.Peekable.html#method.peek /// /// # Examples |
