pub struct BackoffPolicy { /* private fields */ }Expand description
Backoff strategy for retries.
Implementations§
Source§impl BackoffPolicy
impl BackoffPolicy
Sourcepub fn delay(&self, attempt: usize) -> Option<Duration>
pub fn delay(&self, attempt: usize) -> Option<Duration>
Compute the delay for the given attempt number (1-indexed).
Attempt 1 returns None (no delay before the first attempt).
Later attempts use exponential backoff with full jitter: the
delay is drawn uniformly from [0, capped), where capped is
initial_delay * factor^(attempt - 2) clamped to max_delay.
Sourcepub fn initial_delay(&self) -> Duration
pub fn initial_delay(&self) -> Duration
Returns the initial delay.
Trait Implementations§
Source§impl Clone for BackoffPolicy
impl Clone for BackoffPolicy
Source§impl Debug for BackoffPolicy
impl Debug for BackoffPolicy
Auto Trait Implementations§
impl Freeze for BackoffPolicy
impl RefUnwindSafe for BackoffPolicy
impl Send for BackoffPolicy
impl Sync for BackoffPolicy
impl Unpin for BackoffPolicy
impl UnsafeUnpin for BackoffPolicy
impl UnwindSafe for BackoffPolicy
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