pub struct Backoff { /* private fields */ }Expand description
Exponential backoff type.
Implementations§
Source§impl Backoff
impl Backoff
Sourcepub fn new(
max_attempts: u32,
min: Duration,
max: impl Into<Option<Duration>>,
) -> Self
pub fn new( max_attempts: u32, min: Duration, max: impl Into<Option<Duration>>, ) -> Self
Create a new instance.
Sourcepub fn set_jitter(&mut self, jitter: f32)
pub fn set_jitter(&mut self, jitter: f32)
Set the amount of jitter per backoff.
§Panics
This method panics if a number smaller than 0 or larger than 1 is
provided.
Sourcepub fn set_factor(&mut self, factor: u32)
pub fn set_factor(&mut self, factor: u32)
Set the growth factor for each iteration of the backoff.
Trait Implementations§
Source§impl<'b> IntoIterator for &'b Backoff
impl<'b> IntoIterator for &'b 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 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