pub struct RetryPolicy {
pub max_attempts: u32,
pub backoff: BackoffStrategy,
pub on_retry: Option<RetryCallback>,
}
Expand description
Retry policy for handling transient failures
Fields§
§max_attempts: u32
Maximum number of attempts
backoff: BackoffStrategy
Backoff strategy between retries
on_retry: Option<RetryCallback>
Callback for retry events
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn max_attempts(self, attempts: u32) -> Self
pub fn max_attempts(self, attempts: u32) -> Self
Set maximum attempts
Sourcepub fn backoff(self, strategy: BackoffStrategy) -> Self
pub fn backoff(self, strategy: BackoffStrategy) -> Self
Set backoff strategy
Sourcepub fn calculate_delay(&self, attempt: u32) -> Duration
pub fn calculate_delay(&self, attempt: u32) -> Duration
Calculate delay for attempt number
Sourcepub fn is_retryable(error_str: &str) -> bool
pub fn is_retryable(error_str: &str) -> bool
Check if an 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