pub struct BackoffConfig {
pub initial_delay_ms: u64,
pub max_delay_ms: u64,
pub multiplier: f64,
pub max_retries: u32,
}Expand description
Exponential backoff configuration for reconnection attempts
Fields§
§initial_delay_ms: u64Initial delay in milliseconds
max_delay_ms: u64Maximum delay in milliseconds
multiplier: f64Multiplier for exponential backoff
max_retries: u32Maximum number of retries
Implementations§
Source§impl BackoffConfig
impl BackoffConfig
Sourcepub fn with_initial_delay(self, delay_ms: u64) -> Self
pub fn with_initial_delay(self, delay_ms: u64) -> Self
Sets the initial delay
Sourcepub fn with_max_delay(self, delay_ms: u64) -> Self
pub fn with_max_delay(self, delay_ms: u64) -> Self
Sets the maximum delay
Sourcepub fn with_multiplier(self, multiplier: f64) -> Self
pub fn with_multiplier(self, multiplier: f64) -> Self
Sets the multiplier
Sourcepub fn with_max_retries(self, retries: u32) -> Self
pub fn with_max_retries(self, retries: u32) -> Self
Sets the maximum retries
Sourcepub fn calculate_delay(&self, attempt: u32) -> Duration
pub fn calculate_delay(&self, attempt: u32) -> Duration
Calculates the delay for a given retry attempt
Trait Implementations§
Source§impl Clone for BackoffConfig
impl Clone for BackoffConfig
Source§fn clone(&self) -> BackoffConfig
fn clone(&self) -> BackoffConfig
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 BackoffConfig
impl Debug for BackoffConfig
Auto Trait Implementations§
impl Freeze for BackoffConfig
impl RefUnwindSafe for BackoffConfig
impl Send for BackoffConfig
impl Sync for BackoffConfig
impl Unpin for BackoffConfig
impl UnwindSafe for BackoffConfig
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