pub fn retry<F, B, T, E>(backoff: B, op: F) -> Result<T, Error<E>>
Expand description
Retries this operation according to the backoff policy. backoff is reset before it is used.
§Examples
let f = || -> Result<(), Error<&str>> {
// Business logic...
// Give up.
Err(Error::Permanent("error"))
};
let backoff = ExponentialBackoff::default();
let _ = retry(backoff, f).err().unwrap();