pub struct ReconnectOptions {
pub max_attempts: Option<u32>,
pub initial_delay: Duration,
pub max_delay: Duration,
pub backoff_multiplier: f64,
pub use_exponential_backoff: bool,
}Expand description
Options for automatic reconnection.
Fields§
§max_attempts: Option<u32>Maximum number of reconnection attempts (None = unlimited).
initial_delay: DurationInitial delay before first reconnection attempt.
max_delay: DurationMaximum delay between attempts (for exponential backoff).
backoff_multiplier: f64Multiplier for exponential backoff.
use_exponential_backoff: boolWhether to use exponential backoff.
Implementations§
Source§impl ReconnectOptions
impl ReconnectOptions
Sourcepub fn fixed_delay(delay: Duration) -> Self
pub fn fixed_delay(delay: Duration) -> Self
Create options with a fixed delay (no backoff).
Sourcepub fn max_attempts(self, attempts: u32) -> Self
pub fn max_attempts(self, attempts: u32) -> Self
Set maximum number of reconnection attempts.
Sourcepub fn initial_delay(self, delay: Duration) -> Self
pub fn initial_delay(self, delay: Duration) -> Self
Set initial delay before first reconnection attempt.
Sourcepub fn backoff_multiplier(self, multiplier: f64) -> Self
pub fn backoff_multiplier(self, multiplier: f64) -> Self
Set backoff multiplier for exponential backoff.
Sourcepub fn exponential_backoff(self, enabled: bool) -> Self
pub fn exponential_backoff(self, enabled: bool) -> Self
Enable or disable exponential backoff.
Sourcepub fn delay_for_attempt(&self, attempt: u32) -> Duration
pub fn delay_for_attempt(&self, attempt: u32) -> Duration
Calculate delay for a given attempt number.
Trait Implementations§
Source§impl Clone for ReconnectOptions
impl Clone for ReconnectOptions
Source§fn clone(&self) -> ReconnectOptions
fn clone(&self) -> ReconnectOptions
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 ReconnectOptions
impl Debug for ReconnectOptions
Auto Trait Implementations§
impl Freeze for ReconnectOptions
impl RefUnwindSafe for ReconnectOptions
impl Send for ReconnectOptions
impl Sync for ReconnectOptions
impl Unpin for ReconnectOptions
impl UnwindSafe for ReconnectOptions
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