Rust channels have two parts: a Sender<T>
and a Receiver<T>
. The two
parts are connected via the channel, but you only see the end-points.
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
Speaker Notes
This slide should take about 9 minutes.
mpsc
stands for Multi-Producer, Single-Consumer. Sender
and SyncSender
implement Clone
(so you can make multiple producers) but Receiver
does
not.
send()
and recv()
return Result
. If they return Err
, it means the
counterpart Sender
or Receiver
is dropped and the channel is closed.