Skip to content
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion src/part-guide/async-await.md
Original file line number Diff line number Diff line change
Expand Up @@ -78,13 +78,15 @@ The syntax for using await is `some_future.await`, i.e., it is a postfix keyword
Consider the following functions:

```rust,norun
use tokio::time::{sleep, Duration};

// An async function, but it doesn't need to wait for anything.
async fn add(a: u32, b: u32) -> u32 {
a + b
}

async fn wait_to_add(a: u32, b: u32) -> u32 {
sleep(1000).await;
sleep(Duration::from_millis(1000)).await;
a + b
}
```
Expand Down