pub struct Backoff { /* private fields */ }Expand description
Exponential backoff starting at 1 second and capping at 60 seconds.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn next_delay(&mut self) -> Duration
pub fn next_delay(&mut self) -> Duration
Get the next backoff duration and advance the state.
Sourcepub fn reset(&mut self)
pub fn reset(&mut self)
Reset the backoff to the initial value (call on successful connection).
Sourcepub fn current_ms(&self) -> u64
pub fn current_ms(&self) -> u64
Get the current backoff duration in milliseconds.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Backoff
impl RefUnwindSafe for Backoff
impl Send for Backoff
impl Sync for Backoff
impl Unpin for Backoff
impl UnsafeUnpin for Backoff
impl UnwindSafe for Backoff
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