pub struct BackoffPolicy { /* private fields */ }Expand description
A deterministic, jitter-free backoff schedule.
Every delay is derived only from the fingerprinted policy and the retry ordinal, so a restart reproduces the same schedule.
Implementations§
Source§impl BackoffPolicy
impl BackoffPolicy
Sourcepub const fn none() -> BackoffPolicy
pub const fn none() -> BackoffPolicy
Returns the immediate-retry schedule.
Sourcepub fn fixed(delay: Duration) -> Result<BackoffPolicy, FaultPolicyError>
pub fn fixed(delay: Duration) -> Result<BackoffPolicy, FaultPolicyError>
Returns a constant-delay schedule.
§Errors
Returns FaultPolicyError::BackoffDelayTooLong above 24 hours.
Sourcepub fn exponential(
initial: Duration,
multiplier: u32,
maximum: Duration,
) -> Result<BackoffPolicy, FaultPolicyError>
pub fn exponential( initial: Duration, multiplier: u32, maximum: Duration, ) -> Result<BackoffPolicy, FaultPolicyError>
Returns an integer exponential schedule capped at maximum.
§Errors
Rejects a zero multiplier, a delay above 24 hours, and a maximum below the initial delay.
Sourcepub const fn kind(self) -> BackoffKind
pub const fn kind(self) -> BackoffKind
Returns the selected backoff family.
Sourcepub const fn multiplier(self) -> u32
pub const fn multiplier(self) -> u32
Returns the integer growth factor.
Sourcepub fn delay_for(self, ordinal: RetryOrdinal) -> Duration
pub fn delay_for(self, ordinal: RetryOrdinal) -> Duration
Returns the delay that precedes the retry identified by ordinal.
The initial call never waits. Arithmetic is checked and capped at the configured maximum, so a large ordinal cannot overflow or exceed the declared bound.
Trait Implementations§
Source§impl Clone for BackoffPolicy
impl Clone for BackoffPolicy
Source§fn clone(&self) -> BackoffPolicy
fn clone(&self) -> BackoffPolicy
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreimpl Copy for BackoffPolicy
Source§impl Debug for BackoffPolicy
impl Debug for BackoffPolicy
impl Eq for BackoffPolicy
Source§impl Hash for BackoffPolicy
impl Hash for BackoffPolicy
Source§impl PartialEq for BackoffPolicy
impl PartialEq for BackoffPolicy
impl StructuralPartialEq for BackoffPolicy
Auto Trait Implementations§
impl Freeze for BackoffPolicy
impl RefUnwindSafe for BackoffPolicy
impl Send for BackoffPolicy
impl Sync for BackoffPolicy
impl Unpin for BackoffPolicy
impl UnsafeUnpin for BackoffPolicy
impl UnwindSafe for BackoffPolicy
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§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more