Struct two_lock_queue::Sender [] [src]

pub struct Sender<T> { /* fields omitted */ }

The sending-half of the channel.

Each instance of Sender can only be used in a single thread, but it can be cloned to create new Sender instances for the same underlying channel and these new instances can be sent to other threads.

Methods

impl<T> Sender<T>
[src]

[src]

Attempts to send a value on this channel, returning it back if it could not be sent.

A successful send occurs when it is determined that the other end of the channel has not hung up already. An unsuccessful send would be one where the corresponding receiver has already been deallocated. Note that a return value of Err means that the data will never be received, but a return value of Ok does not mean that the data will be received. It is possible for the corresponding receiver to hang up immediately after this function returns Ok.

This function will block the current thread until the channel has capacity to accept the value or there are no more receivers to accept the value.

[src]

Attempts to send a value on this channel, blocking for at most timeout.

The function will always block the current thread if the channel has no available capacity for handling the message. The thread will be blocked for at most timeout, after which, if there still is no capacity, SendTimeoutError::Timeout will be returned.

[src]

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 Sender::send for notes about guarantees of whether the receiver has received the data or not if this function is successful.

[src]

Returns the number of values currently buffered by the channel

[src]

Fully close the channel

This will force close the channel even if there are outstanding Sender and Receiver handles. Further operations on any outstanding handle will result in a disconnected error.

[src]

Returns true if the channel is currently in an open state

[src]

Returns the capacity of the queue

use two_lock_queue::{channel, unbounded};

let (tx, _) = channel(1024);
assert_eq!(tx.capacity(), 1024);

let (tx, _) = unbounded();
assert_eq!(tx.capacity(), usize::MAX);

Trait Implementations

impl<T> Clone for Sender<T>
[src]

[src]

Returns a copy of the value. Read more

1.0.0
[src]

Performs copy-assignment from source. Read more

impl<T> Drop for Sender<T>
[src]

[src]

Executes the destructor for this type. Read more