tokio

tokio is an async runtime for Rust that provides a more sophisticated executor than the minimal block_on.

Why tokio over block_on?

block_on just parks the current thread until the future resolves, which defeats the point when you have multiple pending awaits. tokio multiplexes active awaits onto a pool of threads so they make progress concurrently.

The mio library (which tokio ships) sits underneath the non-blocking I/O examples in ECE459.

Opt in by tagging main and making it async:

#[tokio::main]
async fn main() {
    // do async stuff
}

Other tags (e.g. #[async_std::main]) pick other executors.