pub enum Strategy {
Exponential {
init_min: Milliseconds<u64>,
init_max: Milliseconds<u64>,
},
Delay {
min: Milliseconds<u64>,
max: Milliseconds<u64>,
},
}
Expand description
Strategy to employ when retrying
Variants
Exponential
Fields
init_min: Milliseconds<u64>
Minimum (inclusive) delay for second attempt
init_max: Milliseconds<u64>
Maximum (inclusive) delay for second attempt
Generate a random delay between min
and max
,
and wait until this delay has passed between attempts.
After each failed attempt, double the delay before retrying again.
Delay
Fields
min: Milliseconds<u64>
Minimum (inclusive) delay for attempts
max: Milliseconds<u64>
Maximum (inclusive) delay for attempts
Generate a random delay between min
and max
,
and wait until this delay has passed between attempts.
Implementations
sourceimpl Strategy
impl Strategy
sourcepub fn has_jitter(&self) -> bool
pub fn has_jitter(&self) -> bool
Are min & max delays the same? if so, we should probably skip the random number generation.
sourcepub fn range(&self) -> RangeInclusive<u64>
pub fn range(&self) -> RangeInclusive<u64>
Get the min & max durations as an inclusive range
sourcepub fn max_time(&self, max_attempts: Attempts) -> Milliseconds<u64>
pub fn max_time(&self, max_attempts: Attempts) -> Milliseconds<u64>
Get the amount of time this strategy will take if all attempts fail
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Strategy
impl Send for Strategy
impl Sync for Strategy
impl Unpin for Strategy
impl UnwindSafe for Strategy
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more