Registry / async / smol-timeout

smol-timeout

JSON →
library0.6.1rscratesunverified

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

# Cargo.toml [dependencies] smol-timeout = "0.6.1"
INSTALL
IMPORT
SIG · SMOL-TIMEOUT
S
smol-timeout
asyncrustv0.6.1
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

TimeoutExt
use smol_timeout::TimeoutExt;

Adds a timeout to an async operation using the TimeoutExt trait.

use smol_timeout::TimeoutExt; use std::time::Duration; async fn fetch_data() -> &'static str { "data" } async fn run() { let result = fetch_data().timeout(Duration::from_secs(5)).await; match result { Some(data) => println!("{}", data), None => println!("timed out"), } }
Debug
Known issues
gotchaRequires an async runtime like smol or async-std.
fix
Add smol or async-std as a dependency.
affects: >=0.6.0
Upgrade
Version history
0.6.1latest on crates.io
Audit
Dependencies

No dependency data recorded yet.

Agent activity
18 hits · last 30 days
node
16
OpenAI (training)
1
Resources
smol-timeout — cargo add smol-timeout · libregistry