1 stable release
1.0.0 | Sep 1, 2024 |
---|
#822 in Asynchronous
5KB
tokio-sync2async
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
}
lib.rs
:
Helpers to bridge between sync and async code.
Dependencies
~2–8MB
~47K SLoC