Module channel

Module channel 

Source
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§

ChannelInner 🔒
IntoIter
An owning iterator over messages on a Receiver, created by Receiver::into_iter.
Iter
An iterator over messages on a Receiver, created by iter.
Receiver
The receiving half of channel type.
RecvError
An error returned from the recv function on a Receiver.
SendError
An error returned from the Sender::send function on channels.
Sender
The sending-half of channel type.
TryIter
An iterator that attempts to yield all pending values for a Receiver, created by try_iter.

Enums§

TryRecvError
The list of the possible reasons that try_recv could not return data when called.
TrySendError
The list of the possible error outcomes for the try_send method.

Functions§

channel
Creates a new bounded channel.