Skip to content

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