pub struct RetryState { /* private fields */ }Expand description
Per-request retry state machine.
Implementations§
Source§impl RetryState
impl RetryState
Sourcepub fn new(policy: RetryPolicy) -> Self
pub fn new(policy: RetryPolicy) -> Self
Create a new retry state for the given policy.
Sourcepub fn attempt(&self) -> u32
pub fn attempt(&self) -> u32
Current attempt number (0-indexed; starts at 0 for the first attempt).
Sourcepub fn should_retry(&self, error: &CloudError) -> bool
pub fn should_retry(&self, error: &CloudError) -> bool
Return true if the error is retryable and we have not yet
exhausted all allowed attempts.
Sourcepub fn next_delay(&mut self) -> Option<Duration>
pub fn next_delay(&mut self) -> Option<Duration>
Advance the attempt counter and return the delay to wait before the next
attempt. Returns None when max_attempts has been exhausted.
Auto Trait Implementations§
impl Freeze for RetryState
impl RefUnwindSafe for RetryState
impl Send for RetryState
impl Sync for RetryState
impl Unpin for RetryState
impl UnsafeUnpin for RetryState
impl UnwindSafe for RetryState
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