|
|
|
@ -15,6 +15,7 @@ cfg_unstable! {
|
|
|
|
|
use try_race::TryRace;
|
|
|
|
|
use join::Join;
|
|
|
|
|
use try_join::TryJoin;
|
|
|
|
|
use crate::future::timeout::TimeoutFuture;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
extension_trait! {
|
|
|
|
@ -355,6 +356,18 @@ extension_trait! {
|
|
|
|
|
{
|
|
|
|
|
TryJoin::new(self, other)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
#[doc = r#"
|
|
|
|
|
Waits for both the future and a timeout, if the timeout completes before
|
|
|
|
|
the future, it returns an TimeoutError.
|
|
|
|
|
"#]
|
|
|
|
|
#[cfg(any(feature = "unstable", feature = "docs"))]
|
|
|
|
|
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
|
|
|
|
fn timeout<F, T>(self, dur: Duration) -> impl Future<Output = Self::Output> [TimeoutFuture<Self>]
|
|
|
|
|
where Self: Sized
|
|
|
|
|
{
|
|
|
|
|
TimeoutFuture::new(self, dur)
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl<F: Future + Unpin + ?Sized> Future for Box<F> {
|
|
|
|
|