pub struct ReconnectConfig {
pub max_retries: u32,
pub initial_delay: Duration,
pub max_delay: Duration,
pub backoff_multiplier: f64,
}Expand description
Configuration for automatic reconnection with exponential backoff
When a relay connection drops, it will automatically attempt to reconnect using an exponential backoff strategy.
Fields§
§max_retries: u32Maximum number of reconnection attempts (0 = infinite)
initial_delay: DurationInitial delay before first reconnection attempt
max_delay: DurationMaximum delay between reconnection attempts
backoff_multiplier: f64Multiplier for exponential backoff (e.g., 2.0 doubles the delay each time)
Implementations§
Source§impl ReconnectConfig
impl ReconnectConfig
Sourcepub const fn is_enabled(&self) -> bool
pub const fn is_enabled(&self) -> bool
Check if reconnection is enabled
Sourcepub fn next_delay(&self, attempt: u32) -> Duration
pub fn next_delay(&self, attempt: u32) -> Duration
Calculate the next delay using exponential backoff
Trait Implementations§
Source§impl Clone for ReconnectConfig
impl Clone for ReconnectConfig
Source§fn clone(&self) -> ReconnectConfig
fn clone(&self) -> ReconnectConfig
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 ReconnectConfig
impl Debug for ReconnectConfig
Auto Trait Implementations§
impl Freeze for ReconnectConfig
impl RefUnwindSafe for ReconnectConfig
impl Send for ReconnectConfig
impl Sync for ReconnectConfig
impl Unpin for ReconnectConfig
impl UnwindSafe for ReconnectConfig
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