|
|
|
@ -7,7 +7,6 @@ cfg_unstable! {
|
|
|
|
|
mod try_join;
|
|
|
|
|
|
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
|
|
use delay::DelayFuture;
|
|
|
|
|
use flatten::FlattenFuture;
|
|
|
|
|
use crate::future::IntoFuture;
|
|
|
|
@ -15,6 +14,9 @@ cfg_unstable! {
|
|
|
|
|
use try_race::TryRace;
|
|
|
|
|
use join::Join;
|
|
|
|
|
use try_join::TryJoin;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
cfg_unstable_default! {
|
|
|
|
|
use crate::future::timeout::TimeoutFuture;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -149,7 +151,7 @@ extension_trait! {
|
|
|
|
|
/// dbg!(a.await);
|
|
|
|
|
/// # })
|
|
|
|
|
/// ```
|
|
|
|
|
#[cfg(all(feature = "default", feature = "unstable"))]
|
|
|
|
|
#[cfg(feature = "unstable")]
|
|
|
|
|
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
|
|
|
|
fn delay(self, dur: Duration) -> impl Future<Output = Self::Output> [DelayFuture<Self>]
|
|
|
|
|
where
|
|
|
|
@ -363,13 +365,13 @@ extension_trait! {
|
|
|
|
|
|
|
|
|
|
# Example
|
|
|
|
|
```
|
|
|
|
|
# async_std::task::block_on(async {
|
|
|
|
|
# async_std::task::block_on(async {
|
|
|
|
|
#
|
|
|
|
|
use std::time::Duration;
|
|
|
|
|
|
|
|
|
|
use async_std::prelude::*;
|
|
|
|
|
use async_std::future;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
let fut = future::ready(0);
|
|
|
|
|
let dur = Duration::from_millis(100);
|
|
|
|
|
let res = fut.timeout(dur).await;
|
|
|
|
@ -383,7 +385,7 @@ extension_trait! {
|
|
|
|
|
# });
|
|
|
|
|
```
|
|
|
|
|
"#]
|
|
|
|
|
#[cfg(any(feature = "unstable", feature = "docs"))]
|
|
|
|
|
#[cfg(any(all(feature = "default", feature = "unstable"), feature = "docs"))]
|
|
|
|
|
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
|
|
|
|
|
fn timeout(self, dur: Duration) -> impl Future<Output = Self::Output> [TimeoutFuture<Self>]
|
|
|
|
|
where Self: Sized
|
|
|
|
|