File tree Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Expand file tree Collapse file tree 3 files changed +21
-10
lines changed Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ minutes: 8
44
55# Bounded Channels
66
7- With bounded (synchronous) channels, ` send ` can block the current thread:
7+ With bounded (synchronous) channels, [ ` send() ` ] can block the current thread:
88
99``` rust,editable
1010use std::sync::mpsc;
@@ -32,12 +32,15 @@ fn main() {
3232
3333<details >
3434
35- - Calling ` send ` will block the current thread until there is space in the
35+ - Calling ` send() ` will block the current thread until there is space in the
3636 channel for the new message. The thread can be blocked indefinitely if there
3737 is nobody who reads from the channel.
38- - A call to ` send ` will abort with an error (that is why it returns ` Result ` ) if
39- the channel is closed. A channel is closed when the receiver is dropped.
38+ - A call to ` send() ` will abort with an error (that is why it returns ` Result ` )
39+ if the channel is closed. A channel is closed when the receiver is dropped.
4040- A bounded channel with a size of zero is called a "rendezvous channel". Every
41- send will block the current thread until another thread calls ` recv ` .
41+ send will block the current thread until another thread calls [ ` recv() ` ] .
4242
4343</details >
44+
45+ [ `send()` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.SyncSender.html#method.send
46+ [ `recv()` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html#method.recv
Original file line number Diff line number Diff line change @@ -4,8 +4,8 @@ minutes: 9
44
55# Senders and Receivers
66
7- Rust channels have two parts: a ` Sender<T> ` and a ` Receiver<T> ` . The two parts
8- are connected via the channel, but you only see the end-points.
7+ Rust channels have two parts: a [ ` Sender<T> ` ] and a [ ` Receiver<T> ` ] . The two
8+ parts are connected via the channel, but you only see the end-points.
99
1010``` rust,editable
1111use std::sync::mpsc;
@@ -27,10 +27,16 @@ fn main() {
2727
2828<details >
2929
30- - ` mpsc ` stands for Multi-Producer, Single-Consumer. ` Sender ` and ` SyncSender `
30+ - [ ` mpsc ` ] stands for Multi-Producer, Single-Consumer. ` Sender ` and ` SyncSender `
3131 implement ` Clone ` (so you can make multiple producers) but ` Receiver ` does
3232 not.
33- - ` send() ` and ` recv() ` return ` Result ` . If they return ` Err ` , it means the
33+ - [ ` send() ` ] and [ ` recv() ` ] return ` Result ` . If they return ` Err ` , it means the
3434 counterpart ` Sender ` or ` Receiver ` is dropped and the channel is closed.
3535
3636</details >
37+
38+ [ `Sender<T>` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html
39+ [ `Receiver<T>` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html
40+ [ `send()` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.Sender.html#method.send
41+ [ `recv()` ] : https://doc.rust-lang.org/std/sync/mpsc/struct.Receiver.html#method.recv
42+ [ `mpsc` ] : https://doc.rust-lang.org/std/sync/mpsc/index.html
Original file line number Diff line number Diff line change @@ -4,7 +4,7 @@ minutes: 2
44
55# Unbounded Channels
66
7- You get an unbounded and asynchronous channel with ` mpsc::channel() ` :
7+ You get an unbounded and asynchronous channel with [ ` mpsc::channel() ` ] :
88
99``` rust,editable
1010use std::sync::mpsc;
@@ -29,3 +29,5 @@ fn main() {
2929 }
3030}
3131```
32+
33+ [ `mpsc::channel()` ] : https://doc.rust-lang.org/std/sync/mpsc/fn.channel.html
You can’t perform that action at this time.
0 commit comments