Struct chan::Sender
[−]
[src]
pub struct Sender<T>(_);
The sending half of a channel.
Senders can be cloned any number of times and sent to other threads.
Senders 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 sending halves of a channel are dropped, the channel is closed
automatically. When a channel is closed, no new values can be sent on the
channel. Also, all receive operations either return any values left in the
buffer or return immediately with None
.
Methods
impl<T> Sender<T>
fn send(&self, val: T)
Send a value on this channel.
If this is an asnychronous channel, send
never blocks.
If this is a synchronous channel, send
only blocks when the buffer
is full.
If this is a rendezvous channel, send
blocks until a corresponding
recv
retrieves val
.
Values are guaranteed to be received in the same order that they are sent.
This operation will never panic!
but it can deadlock.