pub struct RetryExecutor<'a> { /* private fields */ }Expand description
Controls retry backoff progression and attempt budgeting.
Implementations§
Source§impl<'a> RetryExecutor<'a>
impl<'a> RetryExecutor<'a>
Sourcepub fn new(policy: &'a RetryPolicy) -> Self
pub fn new(policy: &'a RetryPolicy) -> Self
Create a new executor respecting the supplied retry policy.
Sourcepub fn attempt_budget(&self) -> AttemptBudget
pub fn attempt_budget(&self) -> AttemptBudget
Budget the next attempt, returning either the permitted timeout or exhaustion.
Sourcepub fn remaining_budget(&self) -> Duration
pub fn remaining_budget(&self) -> Duration
Remaining wall-clock budget for the overall retry window.
Sourcepub fn attempts_used(&self) -> u32
pub fn attempts_used(&self) -> u32
Number of retries that have already been consumed.
Sourcepub fn next_backoff(&mut self) -> Option<Duration>
pub fn next_backoff(&mut self) -> Option<Duration>
Advance retry state and compute the backoff delay for the next attempt.
Sourcepub async fn sleep_backoff(&mut self)
pub async fn sleep_backoff(&mut self)
Sleep for the computed backoff window if retrying is permitted.
Trait Implementations§
Auto Trait Implementations§
impl<'a> Freeze for RetryExecutor<'a>
impl<'a> RefUnwindSafe for RetryExecutor<'a>
impl<'a> Send for RetryExecutor<'a>
impl<'a> Sync for RetryExecutor<'a>
impl<'a> Unpin for RetryExecutor<'a>
impl<'a> UnwindSafe for RetryExecutor<'a>
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