-
-
Notifications
You must be signed in to change notification settings - Fork 14.8k
Tracking Issue for PeekableIterator #132973
Copy link
Copy link
Open
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Metadata
Metadata
Assignees
Labels
C-tracking-issueCategory: An issue tracking the progress of sth. like the implementation of an RFCCategory: An issue tracking the progress of sth. like the implementation of an RFCT-libs-apiRelevant to the library API team, which will review and decide on the PR/issue.Relevant to the library API team, which will review and decide on the PR/issue.
Type
Fields
Give feedbackNo fields configured for issues without a type.
Feature gate:
#![feature(peekable_iterator)]This is a tracking issue for the
PeekableIteratortrait, which extendsIteratorwithpeek_withand related methods that inspect the next element without consuming it.Public API
Steps / History
Peektrait for peekable iterators libs-team#176PeekableIteratortrait #132976PeekableIteratortrait #144935Unresolved Questions
peektake&mut selfor&self?&selfmakes sense for iterators such ascore::slice::iterbut precludes implementing the trait onPeekable.What about the return type ofResolved by having the method take a callback.peek? We could always make it returnSelf::Itemlike itertools’sPeekingNext, but that would prevent this trait from being implemented for consuming iterators such asvec::IntoIter, as well asPeekableitself.If we use an associated type, then what should be the bound for it:Borrow,AsRef, or something else?Footnotes
https://std-dev-guide.rust-lang.org/feature-lifecycle/stabilization.html ↩