Function safina_sync::sync_channel
source · [−]Expand description
Creates a new synchronous, bounded channel.
All data sent on the SyncSender
will become available on the Receiver
in the same order as it was sent.
The Receiver
will block until a message becomes available.
This channel has an internal buffer on which messages will be queued.
bound
specifies the buffer size. When the internal buffer becomes full,
future sends will wait for the buffer to open up.
The SyncSender
can be cloned to send
to the same channel multiple
times, but only one Receiver
is supported.
Like asynchronous channels, if the Receiver
is disconnected while trying
to send
with the SyncSender
, the send
method will return a
SendError
. Similarly, If the SyncSender
is disconnected while trying
to recv
, the recv
method will return a RecvError
.
Panics
Panics if bound
is zero.