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

Added ChunksLazy to Stream #2002

Closed
wants to merge 3 commits into from

Conversation

fisherdarling
Copy link

@fisherdarling fisherdarling commented Dec 11, 2019

This implements a "lazy" iterator over the chunks of a stream. The only difference between ChunksLazy and Chunks is that ChunksLazy yields the local buffer if the underlying stream returns Poll::Pending, even if there are no elements in the buffer.

This closes #1919

@mzabaluev
Copy link
Contributor

mzabaluev commented Dec 17, 2019

"Lazy" may be a misleading term; we have future::lazy which means something completely different.
I suggest renaming it to chunks_eager/ChunksEager, as in eager to yield the buffer as soon as no more items are immediately forthcoming.

@mzabaluev
Copy link
Contributor

even if there are no elements in the buffer.

I don't think there is value in returning an empty chunk; in this case, poll_next should return Pending.

@mzabaluev
Copy link
Contributor

mzabaluev commented May 12, 2020

This has been made obsolete by 94b894a.

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.

Stream combinator to produce non-greedy chunks
2 participants