Comment

Comment by dymk

> However, if a library uses async, you have little choice but to make your whole project async.

This isn't true. I'm writing an application right now that is mostly sync, but has a small amount of async code in it. It's easy to spin up a tokio runtime which can run inline on the current thread. Then use it to evaluate a Future.

    tokio::runtime::Builder::new_current_thread().enable_all().build().unwrap().block_on(async {
        println!("I'm async!");
    });
parent dymk 3 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton