#[non_exhaustive]pub struct RetryPolicy { /* private fields */ }Expand description
Retry policy (with defaults; Default is “exponential backoff + jitter,
3 attempts”).
Default backoff: initial 0.5s / factor 2.0 / cap 10s / jitter on (full jitter, to prevent thundering herds).
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn max_attempts(&self) -> usize
pub fn max_attempts(&self) -> usize
Total attempts, including the first call.
Sourcepub fn with_max_attempts(self, max_attempts: usize) -> Self
pub fn with_max_attempts(self, max_attempts: usize) -> Self
Returns a policy with an updated attempt limit.
Sourcepub fn with_backoff(self, backoff: Backoff) -> Self
pub fn with_backoff(self, backoff: Backoff) -> Self
Returns a policy with an updated backoff strategy.
Sourcepub fn with_retryable(self, retryable: Retryable) -> Self
pub fn with_retryable(self, retryable: Retryable) -> Self
Returns a policy with an updated retryability predicate.
Sourcepub fn respect_retry_after(&self) -> bool
pub fn respect_retry_after(&self) -> bool
Whether vendor-provided Retry-After durations override backoff.
Sourcepub fn with_respect_retry_after(self, respect_retry_after: bool) -> Self
pub fn with_respect_retry_after(self, respect_retry_after: bool) -> Self
Returns a policy with updated Retry-After handling.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl !RefUnwindSafe for RetryPolicy
impl !UnwindSafe for RetryPolicy
impl Freeze for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
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