//! Extended external extensions to futures::FutureExt use std::marker::Unpin; use futures::{future, future::Select, Future}; /// This interface is not necessarily complete; feel free to add as-needed. pub trait ExtExt where Self: Future + Send, { fn until(self, f: F) -> Select where Self: Sized, F: FnOnce() -> B, A: Future + From + Send + Unpin, B: Future + Send + Unpin; } impl ExtExt for Fut where Fut: Future + Send, { #[inline] fn until(self, f: F) -> Select where Self: Sized, F: FnOnce() -> B, A: Future + From + Send + Unpin, B: Future + Send + Unpin, { future::select(self.into(), f()) } }