Crates.io | future_handles |
lib.rs | future_handles |
version | 0.2.0 |
source | src |
created_at | 2022-02-05 23:06:30.011861 |
updated_at | 2022-02-06 17:25:46.857984 |
description | A library crate to complete futures via handles |
homepage | |
repository | https://codeberg.org/Mek101/future_handles |
max_upload_size | |
id | 527616 |
size | 33,778 |
A rust library to complete futures via a remote handle.
async fn func() -> Option<u32> {
let (future, handle) = unsync::create();
func_with_callback(|| {
handle.complete(1);
});
match future.await {
// The callback was invoked and the result set via the handle.
Ok(res) => Some(res),
// The callback was never invoked, but the handle has been dropped.
Err(_) => None
}
}