Expand description
Multi-producer, multi-consumer FIFO queue communication primitives.
This module provides message-based communication over channels, concretely defined among two types:
A Sender is used to send data to a Receiver. Both
sender and receiver are clone-able (multi-producer) such that many threads
can send simultaneously to multiple receiver (multi-consumer).
§Disconnection
The send and receive operations on channels will all return a Result
indicating whether the operation succeeded or not. An unsuccessful operation
is normally indicative of the other half of a channel having “hung up” by
being dropped in its corresponding thread.
Once half of a channel has been deallocated, most operations can no longer
continue to make progress, so Err will be returned. Many applications
will continue to unwrap the results returned from this module,
instigating a propagation of failure among threads if one unexpectedly dies.
Structs§
- Channel
Inner 🔒 - Into
Iter - An owning iterator over messages on a
Receiver, created byReceiver::into_iter. - Iter
- An iterator over messages on a
Receiver, created byiter. - Receiver
- The receiving half of
channeltype. - Recv
Error - An error returned from the
recvfunction on aReceiver. - Send
Error - An error returned from the
Sender::sendfunction on channels. - Sender
- The sending-half of
channeltype. - TryIter
- An iterator that attempts to yield all pending values for a
Receiver, created bytry_iter.
Enums§
- TryRecv
Error - The list of the possible reasons that
try_recvcould not return data when called. - TrySend
Error - The list of the possible error outcomes for the
try_sendmethod.
Functions§
- channel
- Creates a new bounded channel.