pub struct ReconnectState { /* private fields */ }Expand description
Tracks reconnection state and calculates delays.
Implementations§
Source§impl ReconnectState
impl ReconnectState
Sourcepub fn new(config: ReconnectConfig) -> Self
pub fn new(config: ReconnectConfig) -> Self
Creates a new reconnect state with the given configuration.
Sourcepub fn on_failure(&mut self) -> Option<Duration>
pub fn on_failure(&mut self) -> Option<Duration>
Records a failed connection attempt and returns the delay before next attempt.
Returns None if max attempts reached or reconnection is disabled.
Sourcepub fn on_success(&mut self)
pub fn on_success(&mut self)
Resets the reconnection state after a successful connection.
Auto Trait Implementations§
impl Freeze for ReconnectState
impl RefUnwindSafe for ReconnectState
impl Send for ReconnectState
impl Sync for ReconnectState
impl Unpin for ReconnectState
impl UnsafeUnpin for ReconnectState
impl UnwindSafe for ReconnectState
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