We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent cc85533 commit 33e7c87Copy full SHA for 33e7c87
src/future/future/mod.rs
@@ -360,6 +360,21 @@ extension_trait! {
360
#[doc = r#"
361
Waits for both the future and a timeout, if the timeout completes before
362
the future, it returns an TimeoutError.
363
+
364
+ # Example
365
+ ```
366
+ #async_std::task::block_on(async {
367
+ let fut = future::ready(0);
368
+ let dur = Duration::from_millis(100);
369
+ let res = fut.timeout(dur).await;
370
+ assert!(res.is_ok());
371
372
373
374
375
+ assert!(res.is_ok())
376
+ # });
377
378
"#]
379
#[cfg(any(feature = "unstable", feature = "docs"))]
380
#[cfg_attr(feature = "docs", doc(cfg(unstable)))]
0 commit comments