Future and promise pairs are the fundamental synchronization primitive in seastar. Unfortunately, cxx doesn't support passing them to rust as they are templates. However, having futures and promises + ability to spawn tasks would be sufficient to replace cxx-async completely.
We have some experience with adding support for lw_shared_ptr in our cxx fork, so let's try the same for futures and promises.
Futures and promises have nontrivial move constructors so Rust musn't manipulate them directly by value but rather through some pointer (reference, std::unique_ptr, Box, etc.)
Future and promise pairs are the fundamental synchronization primitive in seastar. Unfortunately, cxx doesn't support passing them to rust as they are templates. However, having futures and promises + ability to spawn tasks would be sufficient to replace cxx-async completely.
We have some experience with adding support for lw_shared_ptr in our cxx fork, so let's try the same for futures and promises.
Futures and promises have nontrivial move constructors so Rust musn't manipulate them directly by value but rather through some pointer (reference, std::unique_ptr, Box, etc.)
I imagine the following interface:
It's fine to split it in two parts, e.g. implement promise first and then future. I think implementing support for promises should be simpler.