Function tor_hsservice::publish::backoff::optionally_timeout

source ·
fn optionally_timeout<'f, R, F>(
    runtime: &R,
    future: F,
    timeout: Option<Duration>
) -> Pin<Box<dyn FusedFuture<Output = Result<F::Output, TimeoutError>> + Send + 'f>>
where R: Runtime, F: Future + Send + 'f,
Expand description

Wrap a Future with an optional timeout.

If timeout is Some, returns a Timeout that resolves to the value of future if the future completes within timeout, or a TimeoutError if it does not. If timeout is None, returns a new future which maps the specified future’s output type to a Result::Ok.