| Crates.io | futures-timeout |
| lib.rs | futures-timeout |
| version | 0.1.3 |
| created_at | 2024-04-12 04:50:02.34483+00 |
| updated_at | 2025-07-17 17:02:33.77589+00 |
| description | A utility that provides timeouts for futures and streams |
| homepage | |
| repository | https://github.com/dariusc93/futures-timeout |
| max_upload_size | |
| id | 1205997 |
| size | 26,999 |
A simple utility that provides timeouts for futures and streams, which utilizes futures-timer. This library is compatible with wasm32-unknown-unknown target.
fn main() {
futures::executor::block_on(async move {
use std::time::Duration;
use futures_timeout::TimeoutExt;
let fut = async {
futures_timer::Delay::new(Duration::from_secs(30)).await;
};
fut.timeout(Duration::from_secs(5))
.await
.expect_err("should fail");
});
}