pub struct RetryPolicy {
pub max_attempts: u32,
pub base_delay: Duration,
pub max_delay: Duration,
pub strategy: RetryStrategy,
pub retryable_errors: Vec<ErrorKind>,
pub jitter: bool,
}Expand description
Retry policy with circuit breaker support
Fields§
§max_attempts: u32§base_delay: Duration§max_delay: Duration§strategy: RetryStrategy§retryable_errors: Vec<ErrorKind>§jitter: boolImplementations§
Source§impl RetryPolicy
impl RetryPolicy
pub fn exponential(max_attempts: u32) -> Self
pub fn fixed(max_attempts: u32, delay: Duration) -> Self
pub fn with_backoff(self, delay: Duration) -> Self
pub fn with_max_delay(self, delay: Duration) -> Self
pub fn with_jitter(self, jitter: bool) -> Self
pub fn should_retry(&self, error: &ToolError) -> bool
pub fn calculate_backoff(&self, attempt: u32) -> Duration
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 moreAuto 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