pub struct ReconnectConfig { /* private fields */ }Implementations§
Source§impl ReconnectConfig
impl ReconnectConfig
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new reconnect configuration with defaults.
Defaults: infinite retries, 1s backoff, no callbacks.
Sourcepub fn max_retries(self, max_retries: u32) -> Self
pub fn max_retries(self, max_retries: u32) -> Self
Set the maximum number of consecutive reconnect attempts.
None (default) retries forever. Some(0) disables retries.
Sourcepub fn backoff(self, backoff: Duration) -> Self
pub fn backoff(self, backoff: Duration) -> Self
Set a fixed backoff duration between reconnect attempts.
Sourcepub fn on_disconnect<F>(self, f: F) -> Self
pub fn on_disconnect<F>(self, f: F) -> Self
Register a callback invoked when a disconnect is detected.
Sourcepub fn on_reconnect<F>(self, f: F) -> Self
pub fn on_reconnect<F>(self, f: F) -> Self
Register a callback invoked after a successful reconnect.
Trait Implementations§
Source§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 UnsafeUnpin 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