pub async fn timed_request_base<F, T>(
duration: Duration,
description: &str,
future: F,
) -> Result<Result<T, BridgeError>, Elapsed>
Expand description
Wraps a future with a timeout and adds a debug span with the description.
§Arguments
duration
: The maximumDuration
to wait for the future to complete.description
: A string slice describing the operation, used in the timeout error message.future
: TheFuture
to execute. The future should return aResult<T, BridgeError>
.
§Returns
Returns Ok(Ok(T))
if the future completes successfully within the time limit, returns Ok(Err(e))
if the future returns an error, returns Err(Elapsed)
if the request times out.