Skip to main content

retry

Function retry 

Source
pub async fn retry<T, E, Fut: Future<Output = Result<Option<T>, E>>>(
    f: impl Fn() -> Fut,
) -> Result<Option<T>, E>
Expand description

Calls the given function f until it no longer returns Ok(None), and returns the last result which is thus either an Ok(Some(value)) or an Err(err).

When a maximal number of retries is reached (see RetryOptions::max_retries), Ok(None) is returned.

See RetryOptions::retry for more options.