.await — suspend async task. .block_on() — run future to completion.
.await:
.block_on():
1// .await in async2async fn get_data() {3 let data = fetch().await;4 println!("{}", data);5}67// .block_on in sync8fn main() {9 let rt = tokio::runtime::Runtime::new().unwrap();10 let data = rt.block_on(fetch());11 println!("{}", data);12}
Key: .await in async, .block_on in sync.