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::scan #192

Merged
merged 2 commits into from
Sep 15, 2019
Merged

Add Stream::scan #192

merged 2 commits into from
Sep 15, 2019

Conversation

tirr-c
Copy link
Contributor

@tirr-c tirr-c commented Sep 14, 2019

Ref #129. The mapper function f is synchronous and returns bare Option<B>.

Asynchronous f seems tricky to implement right. It requires the wrapper to be self-referential, as a reference to internal state may be captured by the returned future.

Copy link

@ghost ghost left a comment

Choose a reason for hiding this comment

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

Thank you, this looks great! I just have a small request for changes around Unpin.

where
Self: Sized,
St: Unpin,
F: Unpin + FnMut(&mut St, Self::Item) -> Option<B>,
Copy link

Choose a reason for hiding this comment

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

We don't need St nor F to be Unpin because we're never pinning them.

@ghost
Copy link

ghost commented Sep 15, 2019

Thanks!

bors r+

bors bot added a commit that referenced this pull request Sep 15, 2019
192: Add Stream::scan r=stjepang a=tirr-c

Ref #129. The mapper function `f` is synchronous and returns bare `Option<B>`.

Asynchronous `f` seems tricky to implement right. It requires the wrapper to be self-referential, as a reference to internal state may be captured by the returned future.

Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
@bors
Copy link
Contributor

bors bot commented Sep 15, 2019

Build succeeded

  • continuous-integration/travis-ci/push

@bors bors bot merged commit 91e61cf into async-rs:master Sep 15, 2019
bors bot added a commit that referenced this pull request Sep 16, 2019
196: Remove more Unpin bounds for Stream::scan r=stjepang a=tirr-c

cc #192. I missed the bounds on `Stream::scan` itself.

Co-authored-by: Wonwoo Choi <chwo9843@gmail.com>
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.

None yet

1 participant