Skip to content

Instantly share code, notes, and snippets.

@bishtpawan
bishtpawan / async_await.rs
Created April 8, 2020 05:52
This is the simple demonstration of async/await feature of Rust
use futures::executor::block_on;
use async_std::task;
use std::time::Duration;
async fn func_1() {
for i in 1..10 {
print!("f1 ");
if i == 5 {
task::sleep(Duration::from_secs(2)).await;