An open API service indexing awesome lists of open source software.

https://github.com/dmarcuse/manual_future

Manually completable futures for Rust, similar to Java's CompletableFuture
https://github.com/dmarcuse/manual_future

async future rust

Last synced: 3 months ago
JSON representation

Manually completable futures for Rust, similar to Java's CompletableFuture

Awesome Lists containing this project

README

          

# manual_future

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

## Example

```rust
// 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);
```