pub struct RetryPolicy {
pub max_retries: u32,
pub backoff: BackoffStrategy,
}Expand description
A retry policy with configurable attempts and backoff.
Fields§
§max_retries: u32Maximum number of retry attempts (0 = no retries, just the initial attempt).
backoff: BackoffStrategyBackoff strategy between retries.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(max_retries: u32, backoff: BackoffStrategy) -> Self
pub fn new(max_retries: u32, backoff: BackoffStrategy) -> Self
Create a new retry policy.
Sourcepub fn delay(&self, attempt: u32) -> Duration
pub fn delay(&self, attempt: u32) -> Duration
Compute the delay before the given attempt (0-indexed).
Sourcepub fn total_max_delay(&self) -> Duration
pub fn total_max_delay(&self) -> Duration
Total maximum delay across all retries (for timeout budgeting).
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
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq 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