[][src]Crate manual_future

A Future value that resolves once it's explicitly completed, potentially from a different thread or task, similar to Java's CompletableFuture.

Currently, this is implemented using the BiLock from the futures crate.

Examples

Create an incomplete ManualFuture and explicitly complete it with the completer:

let (future, completer) = ManualFuture::<i32>::new();
block_on(async { completer.complete(5).await });
assert_eq!(block_on(future), 5);

Create an initially complete ManualFuture that can be immediately resolved:

assert_eq!(block_on(ManualFuture::new_completed(10)), 10);

Structs

ManualFuture

A value that may or may not be completed yet.

ManualFutureCompleter

Used to complete a ManualFuture so it can be resolved to a given value.