Direct FFI of async functions is absolutely in scope for CXX (on C++20 and up)
but is not implemented yet in the current release. We are aiming for an
implementation that is as easy as:
For now the recommended approach is to handle the return codepath over a oneshot
channel (such as futures::channel::oneshot) represented in an opaque Rust
type on the FFI.
Through a multishot channel such as futures::channel::mpsc::unbounded in
place of the futures::channel::oneshot from above, C++ can send a stream of
values that become a futures::Stream in Rust.
In this case the callback function will take the channel sender by reference,
not as a Box. rust::Fn<void(const StreamThingsContext &ctx, Item item)>