pub async fn retry_async<F, T, E>(
    retry_schedule: impl BackoffSchedule,
    operation: impl FnMut() -> F
) -> Result<T, RetryError<E>>
where F: Future<Output = RetryResult<T, E>>, E: Display,
Expand description

Retry the given operation asynchronously until it succeeds, or until the given Duration iterator ends. It can be used as follows: let retry_policy = RetryWithBackoff::default_setting(); let future = retry_async(retry_policy, || async { let previous = 1; match previous { 1 => RetryResult::Fail(“not retry”), 2 => RetryResult::Success(previous), _ => RetryResult::Retry(“retry”), } });