[−][src]Crate smol_timeout
A way to poll a future until it or a timer completes.
Example
use async_io::Timer; use smol_timeout::TimeoutExt; use std::time::Duration; let foo = async { Timer::after(Duration::from_millis(250)).await; 24 }; let foo = foo.timeout(Duration::from_millis(100)); assert_eq!(foo.await, None); let bar = async { Timer::after(Duration::from_millis(100)).await; 42 }; let bar = bar.timeout(Duration::from_millis(250)); assert_eq!(bar.await, Some(42));
Structs
Timeout | A future polling both another future and a |
Traits
TimeoutExt | An extension trait for |