pub enum Backoff {
None,
Constant(Duration),
Sequence(Vec<Duration>),
Exponential {
initial: Duration,
multiplier: f64,
max: Duration,
},
}Expand description
Built-in delay calculation between attempts. The initial attempt has no delay.
Variants§
None
Retry immediately, while still respecting cancellation and deadlines.
Constant(Duration)
Use one fixed delay for every retry.
Sequence(Vec<Duration>)
Exactly one delay for each retry; the schedule validates its length.
Exponential
Multiply initial by multiplier for each retry, bounded by max.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn sequence(delays: impl IntoIterator<Item = Duration>) -> Self
pub fn sequence(delays: impl IntoIterator<Item = Duration>) -> Self
Construct an explicit delay sequence. Validation occurs when building a schedule.
Sourcepub fn exponential(initial: Duration, multiplier: f64, max: Duration) -> Self
pub fn exponential(initial: Duration, multiplier: f64, max: Duration) -> Self
Construct an exponential delay. The multiplier must be finite and at least one.
Trait Implementations§
impl StructuralPartialEq for Backoff
Auto Trait Implementations§
impl Forget for Backoff
impl Freeze for Backoff
impl Move 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