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::from_fn #1842

Closed
wants to merge 1 commit into from
Closed

Conversation

taiki-e
Copy link
Member

@taiki-e taiki-e commented Aug 30, 2019

Closes #1609

///
/// // Check to see if we've finished counting or not.
/// if count < 6 {
/// future::ready(Some(count))
Copy link
Member Author

Choose a reason for hiding this comment

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

Unfortunately, probably the equivalent of this cannot be written by async/await at this time (from_fn is not very compatible with async / await at this time.).

@cramertj
Copy link
Member

As I mentioned in #1609, I think that this actually just isn't very useful yet until we get proper support for async closures that can mutate their captures. Is there a place where you wanted to use this and found it better than the existing unfold function? I'd rather not add it if it's usually the wrong choice.

@taiki-e
Copy link
Member Author

taiki-e commented Aug 30, 2019

I agreed. As far as I know, there is nothing better than unfold at this time. We should focus on functionality, not appearance.

@taiki-e taiki-e closed this Aug 30, 2019
@taiki-e taiki-e deleted the stream-from-fn branch August 30, 2019 16:41
@taiki-e taiki-e restored the stream-from-fn branch August 30, 2019 16:49
@taiki-e taiki-e deleted the stream-from-fn branch September 18, 2019 04:25
@taiki-e taiki-e mentioned this pull request Nov 22, 2020
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.

replace unfold with from_fn
2 participants