You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
// async-compat = "0.2.1"// async-std = {version = "1.10.0"}// tokio = { version = "1", features = ["full"] }use async_compat::Compat;asyncfnsay_hello(){println!("Hello, world!");}fnmain(){
async_std::task::block_on(Compat::new(async{
tokio::spawn(async{say_hello().await;// some async functionprintln!("this is also hello")});}));}
Option 2 using async-std's tokio1 runtime
// async-std = {version = "1.10.0", features = ["attributes", "tokio1"]}// tokio = { version = "1", features = ["full"] }asyncfnsay_hello(){println!("Hello, world!");}#[async_std::main]asyncfnmain(){let t = tokio::spawn(async{say_hello().await;// some async functionprintln!("this is also hello")});
t.await.unwrap()}