pub struct BackoffStrategy { /* private fields */ }Expand description
Calculates retry delay with exponential backoff and jitter.
Implementations§
Source§impl BackoffStrategy
impl BackoffStrategy
Sourcepub fn new(config: BackoffConfig) -> Self
pub fn new(config: BackoffConfig) -> Self
Creates a new backoff strategy with the given configuration.
Sourcepub fn with_defaults() -> Self
pub fn with_defaults() -> Self
Creates a new backoff strategy with default configuration.
Sourcepub fn config(&self) -> &BackoffConfig
pub fn config(&self) -> &BackoffConfig
Returns a reference to the underlying configuration.
Sourcepub fn calculate_delay(&self, attempt: u32) -> Duration
pub fn calculate_delay(&self, attempt: u32) -> Duration
Calculates delay for the given attempt number.
Sourcepub fn calculate_delay_without_jitter(&self, attempt: u32) -> Duration
pub fn calculate_delay_without_jitter(&self, attempt: u32) -> Duration
Calculates the base delay (without jitter) for the given attempt number.
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 moreAuto Trait Implementations§
impl Freeze for BackoffStrategy
impl RefUnwindSafe for BackoffStrategy
impl Send for BackoffStrategy
impl Sync for BackoffStrategy
impl Unpin 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