pub enum RetryError<E> {
Aborted {
attempts: u32,
elapsed: Duration,
failure: RetryAttemptFailure<E>,
},
AttemptsExceeded {
attempts: u32,
max_attempts: u32,
elapsed: Duration,
last_failure: RetryAttemptFailure<E>,
},
MaxElapsedExceeded {
attempts: u32,
elapsed: Duration,
max_elapsed: Duration,
last_failure: Option<RetryAttemptFailure<E>>,
},
}Expand description
Error returned when a retry executor terminates without a successful result.
The generic parameter E is the caller’s application error type. It is
preserved in the final RetryAttemptFailure whenever the terminal failure came
from the user operation.
Variants§
Aborted
The configured crate::RetryDecider returned crate::RetryDecision::Abort
for the last application error.
Fields
failure: RetryAttemptFailure<E>Failure that caused the abort.
AttemptsExceeded
The maximum number of attempts has been exhausted.
Fields
last_failure: RetryAttemptFailure<E>Last observed failure.
MaxElapsedExceeded
The total elapsed retry budget has been exhausted.
Implementations§
Source§impl<E> RetryError<E>
impl<E> RetryError<E>
Sourcepub fn last_failure(&self) -> Option<&RetryAttemptFailure<E>>
pub fn last_failure(&self) -> Option<&RetryAttemptFailure<E>>
Sourcepub fn last_error(&self) -> Option<&E>
pub fn last_error(&self) -> Option<&E>
Sourcepub fn into_last_error(self) -> Option<E>
pub fn into_last_error(self) -> Option<E>
Consumes the retry error and returns the last application error when the final failure wraps one.
§Parameters
This method has no parameters.
§Returns
Some(E) when the terminal failure owns an application error; None
when the terminal failure was a timeout or when no attempt ran.
§Errors
This method does not return errors.
Trait Implementations§
Source§impl<E: Clone> Clone for RetryError<E>
impl<E: Clone> Clone for RetryError<E>
Source§fn clone(&self) -> RetryError<E>
fn clone(&self) -> RetryError<E>
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl<E: Debug> Debug for RetryError<E>
impl<E: Debug> Debug for RetryError<E>
Source§impl<E> Display for RetryError<E>where
E: Display,
impl<E> Display for RetryError<E>where
E: Display,
Source§impl<E> Error for RetryError<E>where
E: Error + 'static,
impl<E> Error for RetryError<E>where
E: Error + 'static,
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the source application error when one is available.
§Parameters
This method has no parameters.
§Returns
Some(&dyn Error) when the terminal failure wraps an application error
that implements std::error::Error; otherwise None.
§Errors
This method does not return errors.
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
Source§impl<E: PartialEq> PartialEq for RetryError<E>
impl<E: PartialEq> PartialEq for RetryError<E>
impl<E: Eq> Eq for RetryError<E>
impl<E> StructuralPartialEq for RetryError<E>
Auto Trait Implementations§
impl<E> Freeze for RetryError<E>where
E: Freeze,
impl<E> RefUnwindSafe for RetryError<E>where
E: RefUnwindSafe,
impl<E> Send for RetryError<E>where
E: Send,
impl<E> Sync for RetryError<E>where
E: Sync,
impl<E> Unpin for RetryError<E>where
E: Unpin,
impl<E> UnsafeUnpin for RetryError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for RetryError<E>where
E: UnwindSafe,
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
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§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
key and return true if they are equal.