Struct std::sync::mpsc::SyncSender
[−]
[src]
pub struct SyncSender<T> { // some fields omitted }
The sending-half of Rust's synchronous channel type. This half can only be owned by one thread, but it can be cloned to send to other threads.
Methods
impl<T> SyncSender<T>
fn send(&self, t: T) -> Result<(), SendError<T>>
Sends a value on this synchronous channel.
This function will block until space in the internal buffer becomes available or a receiver is available to hand off the message to.
Note that a successful send does not guarantee that the receiver will ever see the data if there is a buffer on this channel. Items may be enqueued in the internal buffer for the receiver to receive at a later time. If the buffer size is 0, however, it can be guaranteed that the receiver has indeed received the data if this function returns success.
This function will never panic, but it may return Err
if the
Receiver
has disconnected and is no longer able to receive
information.
fn try_send(&self, t: T) -> Result<(), TrySendError<T>>
Attempts to send a value on this channel without blocking.
This method differs from send
by returning immediately if the
channel's buffer is full or no receiver is waiting to acquire some
data. Compared with send
, this function has two failure cases
instead of one (one for disconnection, one for a full buffer).
See SyncSender::send
for notes about guarantees of whether the
receiver has received the data or not if this function is successful.