Skip to content

Add PeekableIterator trait #132976

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

bluebear94
Copy link
Contributor

Adds the PeekableIterator trait (tracking issue: #132973) and implementations for slice::Iter and ops::Range.

I tried to implement it for Cloned, but I couldn’t get the types and lifetimes to line up, so the unit test at library/core/tests/iter/traits/peekable.rs is not yet compilable.

@rustbot
Copy link
Collaborator

rustbot commented Nov 13, 2024

r? @scottmcm

rustbot has assigned @scottmcm.
They will have a look at your PR within the next two weeks and either review your PR or reassign to another reviewer.

Use r? to explicitly pick a reviewer

@rustbot rustbot added S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. T-libs Relevant to the library team, which will review and decide on the PR/issue. labels Nov 13, 2024
@scottmcm scottmcm added S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. and removed S-waiting-on-review Status: Awaiting review from the assignee but also interested parties. labels Dec 20, 2024
@scottmcm
Copy link
Member

Since you said this isn't compilable, I've marked it waiting on author. Please flip it back once it's ready for a review.

Note that if you're having trouble with any particular impl, I'd suggest just skipping it for now. Additional impls can always come later in future PRs; they don't need to be in the first one.

@bluebear94
Copy link
Contributor Author

Do you think it would be better to remove the trait bound from the PeekedItem associated type altogether?

@bors
Copy link
Collaborator

bors commented Jan 27, 2025

☔ The latest upstream changes (presumably #135937) made this pull request unmergeable. Please resolve the merge conflicts.

@scottmcm
Copy link
Member

Looks like this needs some conflicts resolved, at least?

Once this is ready for review, please use @rustbot ready so the bot will update the labels appropriately to bring it back to my radar.

@bluebear94
Copy link
Contributor Author

Sorry, I haven’t had the motivation to work on this for a long time. I think this needs more thinking on design.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author. T-libs Relevant to the library team, which will review and decide on the PR/issue.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants