pub struct BackoffConfig {
pub max_attempts: u32,
pub initial_backoff: Duration,
}Expand description
Retry policy for transient network/API failures.
Fields§
§max_attempts: u32§initial_backoff: DurationImplementations§
Source§impl BackoffConfig
impl BackoffConfig
Sourcepub const DEFAULT_TRANSIENT: Self
pub const DEFAULT_TRANSIENT: Self
Canonical transient-error policy: 3 attempts, 500ms initial delay doubled each retry (→ 500ms, 1s before the third attempt).
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Delay before attempt (1-indexed; attempt 0 has no preceding delay).
Returns Duration::ZERO for attempt == 0 so a single tight branch
at the call site handles both the first-attempt and retry cases.
Trait Implementations§
Source§impl Clone for BackoffConfig
impl Clone for BackoffConfig
Source§fn clone(&self) -> BackoffConfig
fn clone(&self) -> BackoffConfig
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · 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 BackoffConfig
impl Debug for BackoffConfig
impl Copy for BackoffConfig
Auto Trait Implementations§
impl Freeze for BackoffConfig
impl RefUnwindSafe for BackoffConfig
impl Send for BackoffConfig
impl Sync for BackoffConfig
impl Unpin for BackoffConfig
impl UnsafeUnpin for BackoffConfig
impl UnwindSafe for BackoffConfig
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