Function backoff::future::retry[][src]

pub fn retry<I, E, Fn, B>(
    backoff: B,
    operation: Fn
) -> Retry<B, NoopNotify, Fn, Fn::Fut> where
    B: Backoff,
    Fn: FutureOperation<I, E>, 

Retries given operation according to the Backoff policy. Backoff is reset before it is used.

Example

use backoff::{future, ExponentialBackoff};

async fn f() -> Result<(), backoff::Error<&'static str>> {
    // Business logic...
    Err(backoff::Error::Permanent("error"))
}

future::retry(ExponentialBackoff::default(), f).await.err().unwrap();