pub struct WaitLinear { /* private fields */ }Expand description
A linearly increasing wait strategy.
Created by linear. The wait after attempt n is
initial + (n - 1) * increment. Overflow saturates at Duration::MAX.
§Examples
use relentless::wait;
use relentless::Wait;
use core::time::Duration;
let w = wait::linear(Duration::from_millis(100), Duration::from_millis(50));
// 100ms + (3-1)*50ms = 200ms
assert_eq!(w.next_wait(&state), Duration::from_millis(200));Trait Implementations§
Source§impl<Rhs: Wait> Add<Rhs> for WaitLinear
impl<Rhs: Wait> Add<Rhs> for WaitLinear
Source§type Output = WaitCombine<WaitLinear, Rhs>
type Output = WaitCombine<WaitLinear, Rhs>
The resulting type after applying the
+ operator.Source§impl Clone for WaitLinear
impl Clone for WaitLinear
Source§fn clone(&self) -> WaitLinear
fn clone(&self) -> WaitLinear
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 WaitLinear
impl Debug for WaitLinear
Source§impl PartialEq for WaitLinear
impl PartialEq for WaitLinear
Source§impl Wait for WaitLinear
impl Wait for WaitLinear
Source§fn next_wait(&self, state: &RetryState) -> Duration
fn next_wait(&self, state: &RetryState) -> Duration
Returns the duration to sleep before the next retry attempt.
Source§fn cap(self, max: Duration) -> WaitCapped<Self>where
Self: Sized,
fn cap(self, max: Duration) -> WaitCapped<Self>where
Self: Sized,
Clamps the returned duration to at most
max.Source§fn chain<W2: Wait>(self, other: W2, after: u32) -> WaitChain<Self, W2>where
Self: Sized,
fn chain<W2: Wait>(self, other: W2, after: u32) -> WaitChain<Self, W2>where
Self: Sized,
Uses this strategy for the first
after attempts, then switches to other.Source§fn add<W2: Wait>(self, other: W2) -> WaitCombine<Self, W2>where
Self: Sized,
fn add<W2: Wait>(self, other: W2) -> WaitCombine<Self, W2>where
Self: Sized,
Adds another wait strategy to this one. Read more
Source§fn jitter(self, max_jitter: Duration) -> Jittered<Self>where
Self: Sized,
fn jitter(self, max_jitter: Duration) -> Jittered<Self>where
Self: Sized,
Adds uniformly distributed jitter in
[0, max_jitter].impl Copy for WaitLinear
impl Eq for WaitLinear
impl StructuralPartialEq for WaitLinear
Auto Trait Implementations§
impl Freeze for WaitLinear
impl RefUnwindSafe for WaitLinear
impl Send for WaitLinear
impl Sync for WaitLinear
impl Unpin for WaitLinear
impl UnsafeUnpin for WaitLinear
impl UnwindSafe for WaitLinear
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