#completable-future #async #complete #future #async-await

manual_future

A future that must be manually completed, similar to Java's CompletableFuture

4 releases

0.1.4 Jan 2, 2026
0.1.3 Jul 20, 2025
0.1.2 Jul 20, 2025
0.1.1 Nov 27, 2019
0.1.0 Nov 23, 2019

#234 in Asynchronous

Download history 93197/week @ 2025-10-27 94368/week @ 2025-11-03 98146/week @ 2025-11-10 72957/week @ 2025-11-17 61825/week @ 2025-11-24 57062/week @ 2025-12-01 69915/week @ 2025-12-08 78029/week @ 2025-12-15 43428/week @ 2025-12-22 36677/week @ 2025-12-29 77902/week @ 2026-01-05 113419/week @ 2026-01-12 107818/week @ 2026-01-19 88963/week @ 2026-01-26 84002/week @ 2026-02-02 109081/week @ 2026-02-09

393,194 downloads per month
Used in 27 crates (6 directly)

MIT license

8KB
107 lines

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);

manual_future

Explicitly completed Future type for Rust, similar to Java's CompletableFuture

Example

// create a new, incomplete ManualFuture
let (future, completer) = ManualFuture::new();

// complete the future with a value
completer.complete(5).await;

// retrieve the value from the future
assert_eq!(future.await, 5);

// you can also create ManualFuture instances that are already completed
assert_eq!(ManualFuture::new_completed(10).await, 10);

Dependencies

~510–720KB
~13K SLoC