1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-02-18 09:40:22 +02:00

Minor fixes to async notes (#607)

* `join!( .., time::sleep(..))` isn't really a "timeout"

* Remove suggestion to make `sleep` take `&mut self`

I'm not sure what doing so demonstrates.

* Update src/async/control-flow/join.md

Co-authored-by: rbehjati <razieh@google.com>

---------

Co-authored-by: rbehjati <razieh@google.com>
This commit is contained in:
Dustin J. Mitchell 2023-05-04 07:59:19 -04:00 committed by GitHub
parent 1288d11adb
commit cce3fff0d0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 6 deletions

View File

@ -43,9 +43,8 @@ Copy this example into your prepared `src/main.rs` and run it from there.
cause your program to stall.
* You can also combine `join_all` with `join!` for instance to join all requests
to an http service as well as a database query.
* Try adding a timeout to the future, using `futures::join!`.
to an http service as well as a database query. Try adding a
`tokio::time::sleep` to the future, using `futures::join!`. This is not a
timeout (that requires `select!`, explained in the next chapter), but demonstrates `join!`.
</details>

View File

@ -60,6 +60,4 @@ async fn main() {
* Try creating a new sleeper struct that will sleep for a random amount of time
and adding it to the Vec.
* Try making the `sleep` call take `&mut self`.
</details>