pub enum RetryStrategy {
None,
Fixed {
max_retries: u32,
delay: Duration,
},
ExponentialBackoff {
max_retries: u32,
initial_delay: Duration,
max_delay: Duration,
multiplier: f64,
},
LinearBackoff {
max_retries: u32,
initial_delay: Duration,
increment: Duration,
max_delay: Duration,
},
}Expand description
Retry strategy for operations
Variants§
None
No retries
Fixed
Fixed number of retries with constant delay
ExponentialBackoff
Exponential backoff with jitter
Fields
LinearBackoff
Linear backoff
Implementations§
Source§impl RetryStrategy
impl RetryStrategy
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Option<Duration>
pub fn delay_for_attempt(&self, attempt: u32) -> Option<Duration>
Calculate delay for a given attempt number (0-indexed)
Returns None if no more retries should be attempted
Sourcepub fn max_retries(&self) -> u32
pub fn max_retries(&self) -> u32
Get maximum number of retries
Sourcepub fn exponential(max_retries: u32, initial_delay: Duration) -> Self
pub fn exponential(max_retries: u32, initial_delay: Duration) -> Self
Create an exponential backoff strategy
Trait Implementations§
Source§impl Clone for RetryStrategy
impl Clone for RetryStrategy
Source§fn clone(&self) -> RetryStrategy
fn clone(&self) -> RetryStrategy
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 RetryStrategy
impl Debug for RetryStrategy
Source§impl Default for RetryStrategy
impl Default for RetryStrategy
Source§fn default() -> RetryStrategy
fn default() -> RetryStrategy
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for RetryStrategy
impl RefUnwindSafe for RetryStrategy
impl Send for RetryStrategy
impl Sync for RetryStrategy
impl Unpin for RetryStrategy
impl UnsafeUnpin for RetryStrategy
impl UnwindSafe for RetryStrategy
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