1
0
mirror of https://github.com/google/comprehensive-rust.git synced 2025-07-05 22:19:01 +02:00

Speaker notes for unbounded channels

This commit is contained in:
Martin Geisler
2024-03-24 11:16:45 +00:00
parent 1a86faf8ab
commit ee1bdf39aa
2 changed files with 14 additions and 1 deletions

View File

@ -30,4 +30,17 @@ fn main() {
}
```
<details>
- The channel is called asynchronous because there is no synchronization between
sending and receiving.
- The channel buffers the values. The buffer grows automatically, similar to how
a `Vec` grows when you push data to it.
- The channel takes ownership of the values when you call [`send()`]. This is
seen in the signature: it takes `T` by value. You thus lose access to the
value you send into a channel.
</details>
[`mpsc::channel()`]: https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html
[`send()`]: https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html#method.send

View File

@ -24,7 +24,7 @@ fn main() {
cycles that will get dropped.
[1]: https://doc.rust-lang.org/std/rc/struct.Rc.html
[2]: ../concurrency/shared_state/arc.md
[2]: ../concurrency/shared-state/arc.md
[3]: https://doc.rust-lang.org/std/sync/struct.Mutex.html
[4]: https://doc.rust-lang.org/std/rc/struct.Weak.html