Trait Peekablepub
Source:trait(pub) Peekable item { (Iterator Self item) }
.peek ( Self → Self (Option item) )
Description
Lookahead protocol for iterators that support inspecting the next element without consuming it. Every Peekable MUST also be an Iterator — the associated item type is shared with the iterator's item via the (Iterator Self | item) constraint.
Types with a natural one-slot lookahead (token streams, buffered readers, lookahead parsers) implement this trait directly. There is no auto-wrapper for "any Iterator"; callers that need lookahead over a plain Iterator MUST provide their own :impl.