pub struct ExponentialBackoff {
pub max_attempts: u32,
pub initial_delay: Duration,
pub multiplier: f64,
pub max_delay: Duration,
}Expand description
Exponential backoff configuration for retry.
Fields§
§max_attempts: u32§initial_delay: Duration§multiplier: f64§max_delay: DurationImplementations§
Source§impl ExponentialBackoff
impl ExponentialBackoff
Sourcepub fn new(max_attempts: u32) -> Self
pub fn new(max_attempts: u32) -> Self
Create a new backoff config with default delays (100ms initial, 2x multiplier, 10s max).
Sourcepub fn with_initial_delay(self, d: Duration) -> Self
pub fn with_initial_delay(self, d: Duration) -> Self
Override the initial delay before the first retry.
Sourcepub fn with_multiplier(self, m: f64) -> Self
pub fn with_multiplier(self, m: f64) -> Self
Override the backoff multiplier applied after each attempt.
Sourcepub fn with_max_delay(self, d: Duration) -> Self
pub fn with_max_delay(self, d: Duration) -> Self
Cap the maximum delay between retries.
Trait Implementations§
Source§impl Clone for ExponentialBackoff
impl Clone for ExponentialBackoff
Source§fn clone(&self) -> ExponentialBackoff
fn clone(&self) -> ExponentialBackoff
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 ExponentialBackoff
impl RefUnwindSafe for ExponentialBackoff
impl Send for ExponentialBackoff
impl Sync for ExponentialBackoff
impl Unpin for ExponentialBackoff
impl UnsafeUnpin 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