Skip to content
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

Add PeekMap and adaptors::peek_map #809

Closed
wants to merge 1 commit into from

Conversation

MiguelX413
Copy link

This is my first pull request to this project so I would appreciate feedback. I will add documentation soon.

@Philippe-Cholet
Copy link
Member

Philippe-Cholet commented Nov 30, 2023

Sidenote: CI only failed because of missing documentation (and missing new tests).

Hi. I'm still writing the CONTRIBUTING.md file in #767 but you might find its draft interesting.

I'm first wondering if it is useful enough to be integrated? Do you have an usecase example? Maybe it should be proposed to libcore first?

And what would be the alternative with the current iterator+itertools? For now, all I see is use "batching" (which is definitely not obvious and the size hint info would be lost).

iterator.peekable().batching(|it| it.next().map(|x| f(x, it.peek())))

(It makes me think of MapWindows<N=2> but different, and a bit of #771.)

EDIT: I think it could be PeekMap<I, F> (no third type) by deleting F constraint on PeekMap definition.

@MiguelX413
Copy link
Author

I'll close this while rust-lang/rust#118474 is in progress.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants