pub struct ReconnectionManager { /* private fields */ }Expand description
Helper for managing reconnection attempts and backoff strategy
Implementations§
Source§impl ReconnectionManager
impl ReconnectionManager
Sourcepub fn new(config: ReconnectionConfig) -> Self
pub fn new(config: ReconnectionConfig) -> Self
Create a new reconnection manager with the given configuration
Sourcepub fn new_default() -> Self
pub fn new_default() -> Self
Create a new reconnection manager with default configuration
Sourcepub fn current_attempt(&self) -> u32
pub fn current_attempt(&self) -> u32
Get the current attempt number (zero-based)
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the attempt counter, typically called after a successful connection
Sourcepub fn is_max_attempts_reached(&self) -> bool
pub fn is_max_attempts_reached(&self) -> bool
Check if we’ve reached the maximum number of attempts
Returns true if we’ve reached the maximum attempts, false if we can try again
Sourcepub fn next_delay(&mut self) -> Option<Duration>
pub fn next_delay(&mut self) -> Option<Duration>
Increment the attempt counter and calculate the next retry delay with exponential backoff
Returns None if max attempts reached, otherwise returns the Duration to wait
Sourcepub fn config(&self) -> &ReconnectionConfig
pub fn config(&self) -> &ReconnectionConfig
Get the configuration
Sourcepub fn set_config(&mut self, config: ReconnectionConfig)
pub fn set_config(&mut self, config: ReconnectionConfig)
Update the configuration
Trait Implementations§
Source§impl Clone for ReconnectionManager
impl Clone for ReconnectionManager
Source§fn clone(&self) -> ReconnectionManager
fn clone(&self) -> ReconnectionManager
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 moreAuto Trait Implementations§
impl Freeze for ReconnectionManager
impl RefUnwindSafe for ReconnectionManager
impl Send for ReconnectionManager
impl Sync for ReconnectionManager
impl Unpin for ReconnectionManager
impl UnwindSafe for ReconnectionManager
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