pub struct ExponentialBackoff { /* private fields */ }Expand description
Exponential backoff strategy
Implements exponential backoff with jitter for retrying failed requests
Implementations§
Source§impl ExponentialBackoff
impl ExponentialBackoff
Sourcepub fn new(
initial_delay: Duration,
max_delay: Duration,
multiplier: f64,
) -> Self
pub fn new( initial_delay: Duration, max_delay: Duration, multiplier: f64, ) -> Self
Create a new exponential backoff strategy
§Arguments
initial_delay- Initial backoff duration (e.g., 100ms)max_delay- Maximum backoff duration (e.g., 30s)multiplier- Backoff multiplier (e.g., 2.0 for doubling)
Sourcepub fn next_delay(&mut self) -> Duration
pub fn next_delay(&mut self) -> Duration
Get the next backoff duration
Auto Trait Implementations§
impl Freeze for ExponentialBackoff
impl RefUnwindSafe for ExponentialBackoff
impl Send for ExponentialBackoff
impl Sync for ExponentialBackoff
impl Unpin for ExponentialBackoff
impl UnwindSafe for ExponentialBackoff
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