diff --git a/docs/src/tutorial/accept_loop.md b/docs/src/tutorial/accept_loop.md index 8a9132120..c46019df3 100644 --- a/docs/src/tutorial/accept_loop.md +++ b/docs/src/tutorial/accept_loop.md @@ -70,5 +70,5 @@ fn main() -> Result<()> { The crucial thing to realise that is in Rust, unlike other languages, calling an async function does **not** run any code. Async functions only construct futures, which are inert state machines. To start stepping through the future state-machine in an async function, you should use `.await`. -In a non-async function, a way to execute a future is to handle it to the executor. +In a non-async function, a way to execute a future is to hand it to the executor. In this case, we use `task::block_on` to execute a future on the current thread and block until it's done. diff --git a/docs/src/tutorial/clean_shutdown.md b/docs/src/tutorial/clean_shutdown.md index 714a92640..0f54dac6a 100644 --- a/docs/src/tutorial/clean_shutdown.md +++ b/docs/src/tutorial/clean_shutdown.md @@ -69,7 +69,7 @@ async fn broker(mut events: Receiver) -> Result<()> { } drop(peers); // 3 for writer in writers { // 4 - writer.await?; + writer.await; } Ok(()) } diff --git a/docs/src/tutorial/receiving_messages.md b/docs/src/tutorial/receiving_messages.md index 09266674b..c39bb1dd7 100644 --- a/docs/src/tutorial/receiving_messages.md +++ b/docs/src/tutorial/receiving_messages.md @@ -9,6 +9,7 @@ We need to: ```rust use async_std::net::TcpStream; +use async_std::io::BufReader; async fn server(addr: impl ToSocketAddrs) -> Result<()> { let listener = TcpListener::bind(addr).await?;