pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff: Duration,
pub max_backoff: Duration,
pub backoff_multiplier: f64,
pub use_jitter: bool,
}Expand description
Retry policy configuration
Fields§
§max_attempts: u32Maximum number of retry attempts
initial_backoff: DurationInitial backoff duration
max_backoff: DurationMaximum backoff duration
backoff_multiplier: f64Backoff multiplier (exponential backoff)
use_jitter: boolWhether to use jitter
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn new(max_attempts: u32) -> Self
pub fn with_backoff(self, initial: Duration, max: Duration) -> Self
pub fn with_multiplier(self, multiplier: f64) -> Self
pub fn with_jitter(self, use_jitter: bool) -> Self
Sourcepub fn backoff_duration(&self, attempt: u32) -> Duration
pub fn backoff_duration(&self, attempt: u32) -> Duration
Calculate backoff duration for given attempt
Sourcepub fn is_retryable(&self, error: &Error) -> bool
pub fn is_retryable(&self, error: &Error) -> bool
Check if error is retryable
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 · 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 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