Struct retry_error::RetryError
source · [−]pub struct RetryError<E> { /* private fields */ }
Expand description
An error type for use when we’re going to do something a few times, and they might all fail.
To use this error type, initialize a new RetryError before you
start trying to do whatever it is. Then, every time the operation
fails, use RetryError::push()
to add a new error to the list
of errors. If the operation fails too many times, you can use
RetryError as an Error
itself.
Implementations
sourceimpl<E> RetryError<E>
impl<E> RetryError<E>
sourcepub fn in_attempt_to<T: Into<String>>(doing: T) -> Self
pub fn in_attempt_to<T: Into<String>>(doing: T) -> Self
Create a new RetryError, with no failed attempts.
The provided doing
argument is a short string that describes
what we were trying to do when we failed too many times. It
will be used to format the final error message; it should be a
phrase that can go after “while trying to”.
This RetryError should not be used as-is, since when no
Error
s have been pushed into it, it doesn’t represent an
actual failure.
sourcepub fn push<T>(&mut self, err: T) where
T: Into<E>,
pub fn push<T>(&mut self, err: T) where
T: Into<E>,
Add an error to this RetryError.
You should call this method when an attempt at the underlying operation has failed.
sourceimpl<E: PartialEq<E>> RetryError<E>
impl<E: PartialEq<E>> RetryError<E>
Trait Implementations
sourceimpl<E: Clone> Clone for RetryError<E>
impl<E: Clone> Clone for RetryError<E>
sourcefn clone(&self) -> RetryError<E>
fn clone(&self) -> RetryError<E>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
sourceimpl<E: Debug> Debug for RetryError<E>
impl<E: Debug> Debug for RetryError<E>
sourceimpl<E: Display> Display for RetryError<E>
impl<E: Display> Display for RetryError<E>
sourceimpl<E: Debug + Display> Error for RetryError<E>
impl<E: Debug + Display> Error for RetryError<E>
1.30.0 · sourcefn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
The lower-level source of this error, if any. Read more
sourcefn backtrace(&self) -> Option<&Backtrace>
fn backtrace(&self) -> Option<&Backtrace>
backtrace
)Returns a stack backtrace, if available, of where this error occurred. Read more
1.0.0 · sourcefn description(&self) -> &str
fn description(&self) -> &str
use the Display impl or to_string()
sourceimpl<E, T> Extend<T> for RetryError<E> where
T: Into<E>,
impl<E, T> Extend<T> for RetryError<E> where
T: Into<E>,
sourcefn extend<C>(&mut self, iter: C) where
C: IntoIterator<Item = T>,
fn extend<C>(&mut self, iter: C) where
C: IntoIterator<Item = T>,
Extends a collection with the contents of an iterator. Read more
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)Extends a collection with exactly one element.
sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Auto Trait Implementations
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> UnwindSafe for RetryError<E> where
E: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more