Module gaffer::future[][src]

Expand description

Promises which can be used by a job to complete a future from another thread. Promises can also be merged, a merged promise completes all the merged futures at the same time.

Example

use gaffer::future::Promise;

let (mut promise1, future1) = Promise::new();
let (promise2, future2) = Promise::new();
promise1.merge(promise2);
std::thread::spawn(move || promise1.fulfill("hello"));

assert_eq!(futures::executor::block_on(future2), Ok("hello"));
assert_eq!(futures::executor::block_on(future1), Ok("hello"));

Structs

The sending side of a promise which can be used to complete a future. If 2 promises are of the same type, they can be merged and then all the futures will be resolved with clones of the result.

The promise was dropped and so a result will never be provided

The receiving side of a promise which will be fulfilled by another thread. Unlike a regular std::future::Future if this is dropped the computation will continue. If the other end is dropped, this will complete with Err(PromiseDropped)