async_utils::channel

Trait TrySend

Source
pub trait TrySend<Item> {
    // Required method
    fn try_send_fut(&mut self, item: Item) -> TrySendFut<'_, Item> ;
}
Expand description

Extends the functionality of a channel to include try_send_fut.

Required Methods§

Source

fn try_send_fut(&mut self, item: Item) -> TrySendFut<'_, Item>

Returns a future that will complete successfully when the item has been buffered in the channel or unsuccessfully when the receiving end has been dropped.

The item is returned to the sender if it could not be sent. This is distinct from the functionality found in the futures library which will consume the item regardless of whether the item was successfully sent.

NOTE: even in the event of successful completion, there is no guarantee that the receiver has consumed the message. It is possible for the receiver to drop its end of the channel without consuming all queued items.

Implementations on Foreign Types§

Source§

impl<Item> TrySend<Item> for Sender<Item>

Source§

fn try_send_fut(&mut self, item: Item) -> TrySendFut<'_, Item>

Implementors§