Closed
Description
We already have a Peekable concrete type that makes it easy for already defined iterators to provide a peek function. I would like to suggest adding a standard trait that defines peekable iterator's behavior: peek and is_empty and next so that users can provide their own optimized peekable iterators, possibly avoiding the intermediate copy made by Peekable for example, but also because this:
fn parse< C, P: PeekableIter< C > >(iter: P) {...}
Looks better than
fn pase< C, I: Iterator< C > >(iter: Peekable< C, I >) {
...
//Keep in mind that peekable returns a reference and not the actual C type.
...
}
Metadata
Metadata
Assignees
Labels
No labels