Function with_timeout

Source
pub async fn with_timeout<T>(
    operation: impl Future<Output = T>,
    duration: Duration,
) -> Result<T, Elapsed>
Expand description

Wrap an async operation with a timeout

ยงErrors

Returns tokio::time::error::Elapsed if the operation does not complete within the specified duration