pub struct ReconnectBackoff { /* private fields */ }Expand description
Exponential backoff tracker for reconnection attempts. Starts at 100ms, doubles each attempt, caps at 30s.
Implementations§
Source§impl ReconnectBackoff
impl ReconnectBackoff
Sourcepub fn new() -> Self
pub fn new() -> Self
Create a new backoff tracker with default parameters. Base delay: 100ms, max delay: 30s.
Sourcepub fn should_retry(&self) -> Option<Duration>
pub fn should_retry(&self) -> Option<Duration>
Returns how long to wait before the next attempt.
Returns None if the backoff period hasn’t elapsed yet
(i.e., the caller must wait before retrying).
Returns Some(Duration::ZERO) if the caller may retry immediately.
Sourcepub fn retry_after(&self) -> Duration
pub fn retry_after(&self) -> Duration
The retry-after duration: how long the caller must wait from now.
Returns Duration::ZERO if retrying is allowed immediately.
Trait Implementations§
Source§impl Debug for ReconnectBackoff
impl Debug for ReconnectBackoff
Auto Trait Implementations§
impl Freeze for ReconnectBackoff
impl RefUnwindSafe for ReconnectBackoff
impl Send for ReconnectBackoff
impl Sync for ReconnectBackoff
impl Unpin for ReconnectBackoff
impl UnsafeUnpin for ReconnectBackoff
impl UnwindSafe for ReconnectBackoff
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