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 stream::repeat_with() method #2279

Merged
merged 4 commits into from
Dec 8, 2020
Merged

Conversation

zhanghanyun
Copy link
Contributor

If the element type of the stream you need does not implement Clone, or if you do not want to keep the repeated element in memory, you can instead use the repeat_with() function.

Copy link
Member

@taiki-e taiki-e left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the PR! This looks reasonable to me. Could you do the following?

  • Rebase (to fix clippy fail)
  • Apply my code suggestion (to fix build fail on old compilers)
  • Move replase_with related code from repeate.rs to a new file futures-util/src/stream/repeat_with.rs. (futures-util usually has its own file for each combinator.)

futures-util/src/stream/repeat.rs Outdated Show resolved Hide resolved
@taiki-e taiki-e added C-feature-request futures-util S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author labels Dec 8, 2020
@taiki-e taiki-e removed the S-waiting-on-author Status: This is awaiting some action (such as code changes or more information) from the author label Dec 8, 2020
@taiki-e taiki-e merged commit 08b643d into rust-lang:master Dec 8, 2020
@taiki-e taiki-e mentioned this pull request Jan 8, 2021
@taiki-e taiki-e added the A-stream Area: futures::stream label Jan 11, 2021
exrook pushed a commit to exrook/futures-rs that referenced this pull request Apr 5, 2021
Co-authored-by: zhy <zhy@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-stream Area: futures::stream
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants