Skip to content

Commit 8998202

Browse files
authored
Clarify how next() interacts with peek() in MultiPeek.
While intuitively this is the most reasonable behavior, it's nice to document it.
1 parent 59cb6f5 commit 8998202

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)