From 3bd0c54111c0e736cb97370044634592351d3b25 Mon Sep 17 00:00:00 2001 From: Rui Loura Date: Thu, 22 Aug 2019 14:16:52 -0700 Subject: [PATCH 1/3] fix typo in tutorial --- docs/src/tutorial/accept_loop.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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. From 282cb9c659d347f96aa02f597aa5b2e44c62ffc9 Mon Sep 17 00:00:00 2001 From: Rui Loura Date: Thu, 22 Aug 2019 14:18:42 -0700 Subject: [PATCH 2/3] add async_std::io::BufReader to tutorial code --- docs/src/tutorial/receiving_messages.md | 1 + 1 file changed, 1 insertion(+) 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?; From 5b9c28a47a4e5ed171c56af46b6277267b8a1707 Mon Sep 17 00:00:00 2001 From: Rui Loura Date: Fri, 23 Aug 2019 05:29:03 -0700 Subject: [PATCH 3/3] writers in clean_shutdown.md return unit type --- docs/src/tutorial/clean_shutdown.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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(()) }