[][src]Crate mrwei

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.



A future waiting for the remote value set by Promise.


A struct that accepts a value and notify the corresponding future.


An error indicates either future or promise is dropped before the other end makes any actions.



Creates a pair of future/promise.