Skip to content

Commit

Permalink
Auto merge of #33016 - tbu-:pr_doc_peekable, r=alexcrichton
Browse files Browse the repository at this point in the history
Add a note about side effects for "peekable" iterators
  • Loading branch information
bors committed Apr 17, 2016
2 parents a626400 + c29585c commit aa58887
Showing 1 changed file with 7 additions and 2 deletions.
9 changes: 7 additions & 2 deletions src/libcore/iter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit aa58887

Please sign in to comment.