pub struct RetryPolicy {
pub max_retries: usize,
pub initial_backoff: Duration,
pub max_backoff: Duration,
}Expand description
Retry policy for transient failures (network timeouts, 5xx errors).
Fields§
§max_retries: usize§initial_backoff: Duration§max_backoff: DurationImplementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn backoff_for(
&self,
attempt: usize,
status: Option<u16>,
is_network_error: bool,
) -> Option<Duration>
pub fn backoff_for( &self, attempt: usize, status: Option<u16>, is_network_error: bool, ) -> Option<Duration>
Decide whether the caller should wait and try again.
attempt is 0-indexed (0 = the first retry decision after the
initial try has failed). Returns Some(backoff) to retry,
None to give up and propagate the error.
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
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe 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