Skip to content

Commit c2587f0

Browse files
Merge #534
534: Clarify how `next()` interacts with `peek()` in` MultiPeek`. r=phimuemue a=b05902132 While intuitively this is the most reasonable behavior, it's nice to document it. Co-authored-by: b05902132 <32428261+b05902132@users.noreply.github.com>
2 parents fa3fffb + 8998202 commit c2587f0

File tree

1 file changed

+1
-0
lines changed

1 file changed

+1
-0
lines changed

src/multipeek_impl.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,7 @@ impl<I: Iterator> MultiPeek<I> {
3838
/// Works exactly like `.next()` with the only difference that it doesn't
3939
/// advance itself. `.peek()` can be called multiple times, to peek
4040
/// further ahead.
41+
/// When `.next()` is called, reset the peeking “cursor”.
4142
pub fn peek(&mut self) -> Option<&I::Item> {
4243
let ret = if self.index < self.buf.len() {
4344
Some(&self.buf[self.index])

0 commit comments

Comments
 (0)