pub enum Backoff {
None,
Fixed(Duration),
Exponential {
base: Duration,
factor: f64,
max: Duration,
jitter: bool,
},
}Expand description
How long to wait between attempts.
Variants§
None
Retry immediately.
Fixed(Duration)
Constant delay between attempts.
Exponential
delay = min(max, base * factor^(attempt-1)), optionally with full jitter.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn exponential() -> Self
pub fn exponential() -> Self
Sensible exponential default: 1s base, x2, capped at 5 minutes, jittered.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Backoff
impl<'de> Deserialize<'de> for Backoff
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl StructuralPartialEq for Backoff
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