From 8a7e8665d2510659d870d7750ac911d9ce15b9b9 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 27 Mar 2020 20:14:09 -0400 Subject: [PATCH 1/2] Fix 'uphelp' and s/and/an --- blog/content/second-edition/posts/12-async-await/index.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/blog/content/second-edition/posts/12-async-await/index.md b/blog/content/second-edition/posts/12-async-await/index.md index cf7ab83f..7669fc93 100644 --- a/blog/content/second-edition/posts/12-async-await/index.md +++ b/blog/content/second-edition/posts/12-async-await/index.md @@ -909,7 +909,7 @@ fn dummy_waker() -> Waker { } ``` -The `from_raw` function is unsafe because undefined behavior can occur if the programmer does not uphelp the documented requirements of `RawWaker`. Before we look at the implementation of the `dummy_raw_waker` function, we first try to understand how the `RawWaker` type works. +The `from_raw` function is unsafe because undefined behavior can occur if the programmer does not uphold the documented requirements of `RawWaker`. Before we look at the implementation of the `dummy_raw_waker` function, we first try to understand how the `RawWaker` type works. ##### `RawWaker` @@ -1376,7 +1376,7 @@ The code is very similar to the code we had in our [keyboard interrupt handler] [`next`]: https://docs.rs/futures-util/0.3.4/futures_util/stream/trait.StreamExt.html#method.next [`StreamExt`]: https://docs.rs/futures-util/0.3.4/futures_util/stream/trait.StreamExt.html -We use `while let` to loop until the stream returns `None` to signal its end. Since our `poll_next` method never returns `None`, this is effectively and endless loop, so the `print_keypresses` task never finishes. +We use `while let` to loop until the stream returns `None` to signal its end. Since our `poll_next` method never returns `None`, this is effectively an endless loop, so the `print_keypresses` task never finishes. Let's add the `print_keypresses` task to our executor in our `main.rs` to get working keyboard input again: From e7a35086f73fa10e47b65803585e7c3ccae93150 Mon Sep 17 00:00:00 2001 From: owen Date: Fri, 27 Mar 2020 20:24:22 -0400 Subject: [PATCH 2/2] Fix trait name in example code (s/Fut/F/) --- blog/content/second-edition/posts/12-async-await/index.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blog/content/second-edition/posts/12-async-await/index.md b/blog/content/second-edition/posts/12-async-await/index.md index 7669fc93..cc563b6d 100644 --- a/blog/content/second-edition/posts/12-async-await/index.md +++ b/blog/content/second-edition/posts/12-async-await/index.md @@ -191,7 +191,7 @@ struct StringLen { inner_future: F, } -impl Future for StringLen where Fut: Future { +impl Future for StringLen where F: Future { type Output = usize; fn poll(mut self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll {