1 unstable release
|0.1.0||Jan 6, 2021|
#1205 in Asynchronous
A simple library that implements the common promise primitive for rust based on std future.
A simple crate to create a promise/future pair.
Promise/future pair is a very common pattern in other languages. You can think it as a oneshot channel, but it's only one way future. The crate is also executor independent.
Include it in cargo dependency:
mrwei = "0.1"
You can use
pair to create an instance of future and promise.
let (f, p) = mrwei::pair::<Type>();
You probably need to either move the future or the promise to another thread and await or set a value respectively. When the promise is offered a value, the corresponding future will also be notified.