Struct marid::Receiver
[−]
[src]
pub struct Receiver<T>(_);
The receiving half of a channel.
Receivers can be cloned any number of times and sent to other threads.
Receivers also implement Sync
, which means they can be shared among
threads without cloning if the channels can be proven to outlive the
execution of the threads.
When all receiving halves of a channel are dropped, no special action is taken. If the buffer in the channel is full, all sends will block indefinitely.
Methods
impl<T> Receiver<T>
fn recv(&self) -> Option<T>
Receive a value on this channel.
If this is an asnychronous channel, recv
only blocks when the
buffer is empty.
If this is a synchronous channel, recv
only blocks when the buffer
is empty.
If this is a rendezvous channel, recv
blocks until a corresponding
send
sends a value.
For all channels, if the channel is closed and the buffer is empty,
then recv
always and immediately returns None
. (If the buffer is
non-empty on a closed channel, then values from the buffer are
returned.)
Values are guaranteed to be received in the same order that they are sent.
This operation will never panic!
but it can deadlock if the channel
is never closed.
fn iter(&self) -> Iter<T>
Return an iterator for receiving values on this channel.
This iterator yields values (blocking if necessary) until the channel is closed.