[][src]Struct flume::Sender

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

A transmitting end of a channel.

Implementations

impl<T: Unpin> Sender<T>[src]

pub fn send_async(&self, item: T) -> SendFuture<'_, T>

Notable traits for SendFuture<'a, T>

impl<'a, T: Unpin> Future for SendFuture<'a, T> type Output = Result<(), SendError<T>>;
[src]

Asynchronously send a value into the channel, returning an error if the channel receiver has been dropped. If the channel is bounded and is full, this method will yield to the async runtime.

pub fn into_send_async(self, item: T) -> SendFuture<'static, T>

Notable traits for SendFuture<'a, T>

impl<'a, T: Unpin> Future for SendFuture<'a, T> type Output = Result<(), SendError<T>>;
[src]

Clones the channel and asynchronously send a value, returning an error if the channel receiver has been dropped. If the channel is bounded and is full, this method will yield to the async runtime.

pub fn sink(&self) -> SendSink<'_, T>[src]

Use this channel as an asynchronous item sink. The returned stream holds a reference to the receiver.

pub fn into_sink(self) -> SendSink<'static, T>[src]

Use this channel as an asynchronous item sink. The returned stream has a 'static lifetime.

impl<T> Sender<T>[src]

pub fn try_send(&self, msg: T) -> Result<(), TrySendError<T>>[src]

Attempt to send a value into the channel. If the channel is bounded and full, or the receiver has been dropped, an error is returned. If the channel associated with this sender is unbounded, this method has the same behaviour as Sender::send.

pub fn send(&self, msg: T) -> Result<(), SendError<T>>[src]

Send a value into the channel, returning an error if the channel receiver has been dropped. If the channel is bounded and is full, this method will block.

pub fn send_deadline(
    &self,
    msg: T,
    deadline: Instant
) -> Result<(), SendTimeoutError<T>>
[src]

Send a value into the channel, returning an error if the channel receiver has been dropped or the deadline has passed. If the channel is bounded and is full, this method will block.

pub fn send_timeout(
    &self,
    msg: T,
    dur: Duration
) -> Result<(), SendTimeoutError<T>>
[src]

Send a value into the channel, returning an error if the channel receiver has been dropped or the timeout has expired. If the channel is bounded and is full, this method will block.

pub fn is_disconnected(&self) -> bool[src]

Returns true if all receivers for this channel have been dropped.

pub fn is_empty(&self) -> bool[src]

Returns true if the channel is empty. Note: Zero-capacity channels are always empty.

pub fn is_full(&self) -> bool[src]

Returns true if the channel is full. Note: Zero-capacity channels are always full.

pub fn len(&self) -> usize[src]

Returns the number of messages in the channel

pub fn capacity(&self) -> Option<usize>[src]

If the channel is bounded, returns its capacity.

Trait Implementations

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

fn clone(&self) -> Self[src]

Clone this sender. Sender acts as a handle to the ending a channel. Remaining channel contents will only be cleaned up when all senders and the receiver have been dropped.

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

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

Auto Trait Implementations

impl<T> !RefUnwindSafe for Sender<T>

impl<T> Send for Sender<T> where
    T: Send

impl<T> Sync for Sender<T> where
    T: Send

impl<T> Unpin for Sender<T>

impl<T> !UnwindSafe for Sender<T>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,