[−][src]Module ndless_async::mpsc
A multi-producer, single-consumer queue for sending values across asynchronous tasks.
Similarly to the std
, channel creation provides Receiver
and
Sender
handles. Receiver
implements Stream
and allows a task to
read values out of the channel. If there is no message to read from the
channel, the current task will be notified when a new value is sent.
Sender
allows a task to send messages into
the channel. If the channel is at capacity, the send will be rejected.
Disconnection
When all Sender
handles have been dropped, it is no longer
possible to send values into the channel. This is considered the termination
event of the stream. As such, Receiver::poll_next
will return Ok(Ready(None))
.
Structs
Receiver | The receiving end of a bounded mpsc channel. |
Sender | The transmission end of a bounded mpsc channel. |
Functions
channel | Creates a bounded mpsc channel for communicating between asynchronous tasks. |