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

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 Errors have been pushed into it, it doesn’t represent an actual failure.

Add an error to this RetryError.

You should call this method when an attempt at the underlying operation has failed.

Return an iterator over all of the reasons that the attempt behind this RetryError has failed.

Return the number of underlying errors.

Return true if no underlying errors have been added.

Group up consecutive errors of the same kind, for easier display.

Two errors have “the same kind” if they return true when passed to the provided dedup function.

Group up consecutive errors of the same kind, according to the PartialEq implementation.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Formats the value using the given formatter. Read more

The lower-level source of this error, if any. Read more

🔬 This is a nightly-only experimental API. (backtrace)

Returns a stack backtrace, if available, of where this error occurred. Read more

👎 Deprecated since 1.42.0:

use the Display impl or to_string()

👎 Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Extends a collection with the contents of an iterator. Read more

🔬 This is a nightly-only experimental API. (extend_one)

Extends a collection with exactly one element.

🔬 This is a nightly-only experimental API. (extend_one)

Reserves capacity in a collection for the given number of additional elements. Read more

The type of the elements being iterated over.

Which kind of iterator are we turning this into?

Creates an iterator from a value. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

Converts the given value to a String. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.