ClosedExt

Trait ClosedExt 

Source
pub trait ClosedExt<T> {
    // Required method
    fn closed(&mut self) -> Closed<'_, T> ;
}
Expand description

Extension trait to detect when a oneshot::Receiver is dropped.

Required Methods§

Source

fn closed(&mut self) -> Closed<'_, T>

Returns a future that resolves when the receiver is dropped.

§Examples
use futures::channel::oneshot;
use commonware_utils::futures::ClosedExt;

let (mut tx, rx) = oneshot::channel::<i32>();

let closed = tx.closed();
drop(rx);
closed.await;

Implementations on Foreign Types§

Source§

impl<T> ClosedExt<T> for Sender<T>

Source§

fn closed(&mut self) -> Closed<'_, T>

Implementors§