Skip to content

Extend the book's async page to show multiple calls to rust::Fn producing a stream #861

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

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

jerel
Copy link

@jerel jerel commented May 3, 2021

As documented in #856 this is a small edit to the async page to show returning streaming values by repeatedly executing a rust::Fn

If you don't feel like this would fit in with the goals of the book feel free to reject it. I thought I'd open the PR since having this myself would have helped me connect some dots of how the interaction between Rust and C++ works.

Comment on lines +104 to +106
done(*ctx, std::move(res));
done(*ctx, std::move(res));
done(*ctx, std::move(res));
Copy link
Owner

Choose a reason for hiding this comment

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

Are you able to share some code structure that is more illustrative of how these res values would be obtained asynchronously in C++? As is, this example looks like it is just synchronously sending 3 values, which would not make sense to treat as futures::Stream in Rust. And something like co_await arg->next() does not work because this function is not a coroutine.

I am not familiar enough with streaming APIs in C++ to tell from this example how it would translate to usable real-world code.

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