Enum RetryError
pub enum RetryError<E> {
Permanent(E),
Transient {
err: E,
retry_after: Option<Duration>,
},
}Expand description
Error is the error value in an actions’s retry result.
Based on the two possible values, the operation may be retried.
Variants§
Permanent(E)
Permanent means that it’s impossible to execute the operation
successfully. This error is an early return from the retry operation.
Transient
Transient means that the error is temporary. If the retry_after is None
the operation should be retried according to the defined strategy policy, else after
the specified duration. Useful for handling rate limits like a HTTP 429 response.
Implementations§
§impl<E> Error<E>
impl<E> Error<E>
pub fn permanent(err: E) -> Error<E>
pub fn to_permanent<T>(err: E) -> Result<T, Error<E>>
pub fn transient(err: E) -> Error<E>
pub fn to_transient<T>(err: E) -> Result<T, Error<E>>
pub fn to_retry_after<T>(err: E, duration: Duration) -> Result<T, Error<E>>
pub fn to_retry_after<T>(err: E, duration: Duration) -> Result<T, Error<E>>
Creates a Result::Err container with a transient error which is retried after the specified duration. Useful for handling rate limits like a HTTP 429 response.
pub fn retry_after(err: E, duration: Duration) -> Error<E>
pub fn retry_after(err: E, duration: Duration) -> Error<E>
Creates a transient error which is retried after the specified duration. Useful for handling rate limits like a HTTP 429 response.
Trait Implementations§
§impl<E> Error for Error<E>where
E: Error,
impl<E> Error for Error<E>where
E: Error,
§fn description(&self) -> &str
fn description(&self) -> &str
§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
§impl<E> From<E> for Error<E>
By default all errors are transient. Permanent errors can
be constructed explicitly. This implementation is for making
the question mark operator (?) and the try! macro to work.
impl<E> From<E> for Error<E>
By default all errors are transient. Permanent errors can
be constructed explicitly. This implementation is for making
the question mark operator (?) and the try! macro to work.
Auto Trait Implementations§
impl<E> Freeze for Error<E>where
E: Freeze,
impl<E> RefUnwindSafe for Error<E>where
E: RefUnwindSafe,
impl<E> Send for Error<E>where
E: Send,
impl<E> Sync for Error<E>where
E: Sync,
impl<E> Unpin for Error<E>where
E: Unpin,
impl<E> UnwindSafe for Error<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
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request§impl<L> LayerExt<L> for L
impl<L> LayerExt<L> for L
§fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
fn named_layer<S>(&self, service: S) -> Layered<<L as Layer<S>>::Service, S>where
L: Layer<S>,
Layered].§impl<T> Pointable for T
impl<T> Pointable for T
§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
§impl<T> ToStringFallible for Twhere
T: Display,
impl<T> ToStringFallible for Twhere
T: Display,
§fn try_to_string(&self) -> Result<String, TryReserveError>
fn try_to_string(&self) -> Result<String, TryReserveError>
ToString::to_string, but without panic on OOM.