Skip to main content

ExtExt

Trait ExtExt 

Source
pub trait ExtExt<T>
where Self: Future<Output = T> + Send,
{ // Required method fn until<A, B, F>(self, f: F) -> Select<A, B> where Self: Sized, F: FnOnce() -> B, A: Future<Output = T> + From<Self> + Send + Unpin, B: Future<Output = ()> + Send + Unpin; }
Expand description

Adds a stop-future race to ordinary futures.

The returned selector resolves when either future completes. Its output identifies the winner and retains the unfinished future.

Required Methods§

Source

fn until<A, B, F>(self, f: F) -> Select<A, B>
where Self: Sized, F: FnOnce() -> B, A: Future<Output = T> + From<Self> + Send + Unpin, B: Future<Output = ()> + Send + Unpin,

Races the receiver against a unit-output stopping future.

f constructs the stopping future when the selector is created. The returned [Select] preserves whichever future has not completed.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<T, Fut> ExtExt<T> for Fut
where Fut: Future<Output = T> + Send,