pub struct RetryPolicy { /* private fields */ }Expand description
Bounded exponential backoff applied between delivery attempts.
Implementations§
Source§impl RetryPolicy
impl RetryPolicy
Sourcepub const fn new(max_attempts: u32) -> Self
pub const fn new(max_attempts: u32) -> Self
Creates a policy that stops after max_attempts deliveries.
Values below one are clamped to one, so a delivery is always attempted.
Sourcepub const fn with_initial_backoff(self, initial_backoff: Duration) -> Self
pub const fn with_initial_backoff(self, initial_backoff: Duration) -> Self
Sets the delay applied before the second attempt.
Sourcepub const fn with_max_backoff(self, max_backoff: Duration) -> Self
pub const fn with_max_backoff(self, max_backoff: Duration) -> Self
Caps how long the backoff can grow.
Sourcepub const fn with_multiplier(self, multiplier: u32) -> Self
pub const fn with_multiplier(self, multiplier: u32) -> Self
Sets the growth factor between attempts, clamped to at least one.
Sourcepub const fn max_attempts(self) -> u32
pub const fn max_attempts(self) -> u32
Returns the attempt ceiling.
Sourcepub fn backoff(self, attempt: u32) -> Duration
pub fn backoff(self, attempt: u32) -> Duration
Returns the delay applied before attempt is retried.
Sourcepub const fn is_exhausted(self, attempt: u32) -> bool
pub const fn is_exhausted(self, attempt: u32) -> bool
Reports whether attempt has reached the ceiling.
Trait Implementations§
Source§impl Clone for RetryPolicy
impl Clone for RetryPolicy
Source§fn clone(&self) -> RetryPolicy
fn clone(&self) -> RetryPolicy
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 RetryPolicy
Source§impl Debug for RetryPolicy
impl Debug for RetryPolicy
Source§impl Default for RetryPolicy
impl Default for RetryPolicy
impl Eq for RetryPolicy
Source§impl PartialEq for RetryPolicy
impl PartialEq for RetryPolicy
impl StructuralPartialEq for RetryPolicy
Auto Trait Implementations§
impl Freeze for RetryPolicy
impl RefUnwindSafe for RetryPolicy
impl Send for RetryPolicy
impl Sync for RetryPolicy
impl Unpin for RetryPolicy
impl UnsafeUnpin for RetryPolicy
impl UnwindSafe for RetryPolicy
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