pub struct ConstantBackoff { /* private fields */ }Expand description
A fixed-delay reconnect policy.
Implementations§
Source§impl ConstantBackoff
impl ConstantBackoff
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.
This budget is consumed only by failure causes and not by normal disconnects after a valid SSE response.
Sourcepub fn with_jitter(self) -> Self
pub fn with_jitter(self) -> Self
Enables jitter on computed failure delays.
Trait Implementations§
Source§impl Clone for ConstantBackoff
impl Clone for ConstantBackoff
Source§fn clone(&self) -> ConstantBackoff
fn clone(&self) -> ConstantBackoff
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 ConstantBackoff
impl Debug for ConstantBackoff
Source§impl Default for ConstantBackoff
impl Default for ConstantBackoff
Source§fn default() -> Self
fn default() -> Self
Returns the default reconnect policy used by crate::replayable::EventSource.
The default is a constant 3 second delay.
Source§impl PartialEq for ConstantBackoff
impl PartialEq for ConstantBackoff
Source§impl RetryPolicy for ConstantBackoff
impl RetryPolicy for ConstantBackoff
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 ConstantBackoff
impl StructuralPartialEq for ConstantBackoff
Auto Trait Implementations§
impl Freeze for ConstantBackoff
impl RefUnwindSafe for ConstantBackoff
impl Send for ConstantBackoff
impl Sync for ConstantBackoff
impl Unpin for ConstantBackoff
impl UnsafeUnpin for ConstantBackoff
impl UnwindSafe for ConstantBackoff
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.