struct Peek<T: Iterator>Properties
let inner: T
The source iterator advanced to fill the lookahead buffer.
let peeked: Element?
The buffered next element, when one has been read ahead.
Methods
mut func peek() -> &T.Element?
Fills and borrows the one-element lookahead buffer without advancing again.
A buffered none records permanent source exhaustion, so repeated peeks do not repeatedly call the source iterator.
View Source
pub mut func peek() -> &T.Element? {
if self.has_peeked { return self.peeked }
self.peeked = self.inner.next()
self.has_peeked = true
return self.peeked
}