Struct retry::Retry
[−]
[src]
pub struct Retry<'a, F: FnMut() -> R + 'a, G: FnMut(&R) -> bool + 'a, R> { /* fields omitted */ }
Builder object for a retryable operation.
Methods
impl<'a, F: FnMut() -> R, G: FnMut(&R) -> bool, R> Retry<'a, F, G, R>
[src]
fn new(value_fn: &'a mut F, condition_fn: &'a mut G) -> Retry<'a, F, G, R> where
F: FnMut() -> R,
G: FnMut(&R) -> bool,
F: FnMut() -> R,
G: FnMut(&R) -> bool,
Builds a new Retry
object.
fn execute(self) -> Result<R, RetryError>
Begins executing the retryable operation.
fn timeout(self, max: u64) -> Retry<'a, F, G, R>
Sets the maximum number of milliseconds retries will be made before failing.
fn try(self, tries: u64) -> Retry<'a, F, G, R>
Sets the maximum number of tries to make before failing.
fn wait(self, wait: u64) -> Retry<'a, F, G, R>
Sets the number of milliseconds to wait between tries.
Mutually exclusive with wait_between
and wait_exponentially
.
fn wait_between(self, min: u64, max: u64) -> Retry<'a, F, G, R>
Sets a range for a randomly chosen number of milliseconds to wait between tries. A new random value from the range is chosen for each try.
Mutually exclusive with wait
and wait_exponentially
.
fn wait_exponentially(self, multiplier: f64) -> Retry<'a, F, G, R>
Sets a multiplier in milliseconds to use in exponential backoff between tries.
Mutually exclusive with wait
and wait_between
.