pub enum BackoffStrategy {
Fixed {
delay_ms: DelayMilliseconds,
},
Exponential {
base_ms: DelayMilliseconds,
},
}Expand description
Defines the delay strategy between retry attempts.
Different backoff strategies are useful for different scenarios:
- Fixed: Predictable timing for rate-limited APIs
- Exponential: Reduces load during high-traffic periods
Variants§
Fixed
Fixed delay between all retry attempts.
§Examples
let strategy = BackoffStrategy::Fixed {
delay_ms: DelayMilliseconds::new(50),
};Fields
§
delay_ms: DelayMillisecondsDelay in milliseconds between each retry attempt
Exponential
Exponential backoff with base delay multiplied by 2^attempt.
§Examples
let strategy = BackoffStrategy::Exponential {
base_ms: DelayMilliseconds::new(10),
};Fields
§
base_ms: DelayMillisecondsBase delay in milliseconds (multiplied by 2^attempt)
Trait Implementations§
Source§impl Clone for BackoffStrategy
impl Clone for BackoffStrategy
Source§fn clone(&self) -> BackoffStrategy
fn clone(&self) -> BackoffStrategy
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for BackoffStrategy
impl Debug for BackoffStrategy
Source§impl PartialEq for BackoffStrategy
impl PartialEq for BackoffStrategy
impl Copy for BackoffStrategy
impl Eq for BackoffStrategy
impl StructuralPartialEq for BackoffStrategy
Auto Trait Implementations§
impl Freeze for BackoffStrategy
impl RefUnwindSafe for BackoffStrategy
impl Send for BackoffStrategy
impl Sync for BackoffStrategy
impl Unpin for BackoffStrategy
impl UnsafeUnpin for BackoffStrategy
impl UnwindSafe for BackoffStrategy
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more