pub enum RetryPolicy {
Count(u32),
Linear {
attempts: u32,
delay: Duration,
should_retry: Option<ShouldRetryFn>,
},
Exponential {
attempts: u32,
base_delay: Duration,
max_delay: Duration,
should_retry: Option<ShouldRetryFn>,
},
}Expand description
Retry policy configuration.
The attempts value is the maximum number of retries after the initial request.
For example, RetryPolicy::count(2) performs up to three HTTP calls (one initial + two retries).
Variants§
Count(u32)
Shorthand for linear retry with attempts retries and a 1 second delay between attempts.
Linear
Exponential
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn count(attempts: u32) -> Self
pub fn linear(attempts: u32, delay: Duration) -> Self
pub fn exponential( attempts: u32, base_delay: Duration, max_delay: Duration, ) -> Self
pub fn with_should_retry(self, f: ShouldRetryFn) -> Self
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 moreAuto 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