pub struct RetryPolicy {
pub max_attempts: u32,
pub initial_backoff_ms: u64,
pub max_backoff_ms: u64,
pub backoff_multiplier: f64,
}Expand description
Configuration for retry behavior with exponential backoff.
Defines how many times to retry an operation and how long to wait between attempts, using exponential backoff with configurable parameters.
Fields§
§max_attempts: u32Maximum number of retry attempts (not including the initial attempt)
initial_backoff_ms: u64Initial backoff duration in milliseconds
max_backoff_ms: u64Maximum backoff duration in milliseconds
backoff_multiplier: f64Multiplier applied to backoff after each retry
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub fn new(
max_attempts: u32,
initial_backoff_ms: u64,
max_backoff_ms: u64,
backoff_multiplier: f64,
) -> Self
pub fn new( max_attempts: u32, initial_backoff_ms: u64, max_backoff_ms: u64, backoff_multiplier: f64, ) -> Self
Creates a new retry policy with the specified parameters.
Sourcepub fn backoff_duration(&self, attempt: u32) -> Duration
pub fn backoff_duration(&self, attempt: u32) -> Duration
Calculates the backoff duration for a given attempt number (0-indexed).
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