pub struct ExponentialBackoff { /* private fields */ }Expand description
An exponential reconnect policy.
Implementations§
Source§impl ExponentialBackoff
impl ExponentialBackoff
Sourcepub fn new(initial_delay: Duration) -> Self
pub fn new(initial_delay: Duration) -> Self
Creates an exponential reconnect policy using initial_delay as the base.
Sourcepub fn with_max_delay(self, max_delay: Duration) -> Self
pub fn with_max_delay(self, max_delay: Duration) -> Self
Clamps both configured and server-provided delays to max_delay.
Sourcepub fn with_max_retries(self, max_retries: usize) -> Self
pub fn with_max_retries(self, max_retries: usize) -> Self
Limits how many consecutive failures may be retried.
Sourcepub fn with_jitter(self) -> Self
pub fn with_jitter(self) -> Self
Enables jitter on computed failure delays.
Trait Implementations§
Source§impl Clone for ExponentialBackoff
impl Clone for ExponentialBackoff
Source§fn clone(&self) -> ExponentialBackoff
fn clone(&self) -> ExponentialBackoff
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 moreSource§impl Debug for ExponentialBackoff
impl Debug for ExponentialBackoff
Source§impl PartialEq for ExponentialBackoff
impl PartialEq for ExponentialBackoff
Source§impl RetryPolicy for ExponentialBackoff
impl RetryPolicy for ExponentialBackoff
Source§fn next_delay(&self, context: RetryContext) -> Option<Duration>
fn next_delay(&self, context: RetryContext) -> Option<Duration>
Returns the delay before the next reconnect attempt, or
None to stop reconnecting.impl Eq for ExponentialBackoff
impl StructuralPartialEq for ExponentialBackoff
Auto Trait Implementations§
impl Freeze for ExponentialBackoff
impl RefUnwindSafe for ExponentialBackoff
impl Send for ExponentialBackoff
impl Sync for ExponentialBackoff
impl Unpin for ExponentialBackoff
impl UnsafeUnpin for ExponentialBackoff
impl UnwindSafe for ExponentialBackoff
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.