Crates.io | tokio-sync2async |
lib.rs | tokio-sync2async |
version | 1.0.0 |
source | src |
created_at | 2024-09-01 12:15:05.384155 |
updated_at | 2024-09-01 12:15:05.384155 |
description | Helpers to bridge between sync and async code. |
homepage | |
repository | https://github.com/qrichert/tokio-sync2async.git |
max_upload_size | |
id | 1359578 |
size | 8,261 |
Helpers to bridge between sync and async code.
use tokio_sync2async::sync_await;
#[tokio::main]
async fn main() {
sync_fn();
}
fn sync_fn() {
let res = sync_await(async_fn());
assert_eq!(res, 42);
}
async fn async_fn() -> i32 {
42
}