How to Set Up the Tokio Runtime in Rust

Set up the Tokio runtime in Rust by using the trpl::block_on helper to execute async functions.

Set up the Tokio runtime by adding the trpl crate to your project and calling trpl::block_on to execute your async function. This helper creates a new Runtime instance and runs your future to completion.

use trpl;

fn main() {
    trpl::block_on(async {
        println!("Hello from Tokio!");
    });
}