smol-timeout

img img img

A way to poll a future until it or a timer completes.

Example

```rust use asyncio::Timer; use smoltimeout::TimeoutExt; use std::time::Duration;

let foo = async { Timer::new(Duration::from_millis(250)).await; 24 };

let foo = foo.timeout(Duration::frommillis(100)); asserteq!(foo.await, None);

let bar = async { Timer::new(Duration::from_millis(100)).await; 42 };

let bar = bar.timeout(Duration::frommillis(250)); asserteq!(bar.await, Some(42)); ```

License

This Source Code Form is subject to the terms of the Mozilla Public License, v. 2.0. If a copy of the MPL was not distributed with this file, You can obtain one at http://mozilla.org/MPL/2.0/.