1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-03-21 06:36:31 +02:00

Minor fixes in async (#771)

This commit is contained in:
rbehjati 2023-06-05 17:12:00 +01:00 committed by GitHub
parent 6f1afdb36b
commit 7257052f0c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 6 deletions

View File

@ -1,6 +1,6 @@
# Async Channels
Several crates have support for `async`/`await`. For instance `tokio` channels:
Several crates have support for asynchronous channels. For instance `tokio`:
```rust,editable,compile_fail
use tokio::sync::mpsc::{self, Receiver};

View File

@ -5,9 +5,10 @@ that future's result. In JavaScript, this is similar to `Promise.race`. In
Python, it compares to `asyncio.wait(task_set,
return_when=asyncio.FIRST_COMPLETED)`.
This is usually a macro, similar to match, with each arm of the form `pattern =
future => statement`. When the future is ready, the statement is executed with the
variable bound to the future's result.
Similar to a match statement, the body of `select!` has a number of arms, each
of the form `pattern = future => statement`. When the `future` is ready, the
`statement` is executed with the variables in `pattern` bound to the `future`'s
result.
```rust,editable,compile_fail
use tokio::sync::mpsc::{self, Receiver};

View File

@ -1,7 +1,6 @@
# Tasks
Runtimes have the concept of a "task", similar to a thread but much
less resource-intensive.
Rust has a task system, which is a form of lightweight threading.
A task has a single top-level future which the executor polls to make progress.
That future may have one or more nested futures that its `poll` method polls,