#tokio #async #sync #bridge #helper #await

tokio-sync2async

Helpers to bridge between sync and async code

1 stable release

1.0.0 Sep 1, 2024

#697 in Asynchronous

Download history 145/week @ 2024-09-01 13/week @ 2024-09-08

158 downloads per month

MIT license

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–7.5MB
~47K SLoC