pub enum RetryClass {
RetryAfter(Duration),
RateLimited,
Unavailable,
Timeout,
Revoked,
Permanent,
}Expand description
How a caller should react to a failed upstream request.
Variants§
RetryAfter(Duration)
The upstream asked for a specific wait before the next attempt.
This is a rate limit that came with a usable Retry-After value.
RateLimited
The upstream rate limited the request without saying for how long.
Back off with the client’s own schedule.
The upstream is failing or unreachable and the request may be retried.
Timeout
The request timed out before a response arrived.
Revoked
The credential was rejected; re-authorize instead of retrying.
Permanent
The request will fail the same way again; do not retry.
Implementations§
Source§impl RetryClass
impl RetryClass
Sourcepub const fn is_retryable(self) -> bool
pub const fn is_retryable(self) -> bool
Returns whether retrying the same request can succeed.
RetryClass::Revoked and RetryClass::Permanent return false:
both need an operator or a re-authorization, not another attempt.
Sourcepub const fn retry_after(self) -> Option<Duration>
pub const fn retry_after(self) -> Option<Duration>
Returns the wait the upstream asked for, if it named one.
Trait Implementations§
Source§impl Clone for RetryClass
impl Clone for RetryClass
impl Copy for RetryClass
Source§impl Debug for RetryClass
impl Debug for RetryClass
impl Eq for RetryClass
Source§impl PartialEq for RetryClass
impl PartialEq for RetryClass
impl StructuralPartialEq for RetryClass
Auto Trait Implementations§
impl Freeze for RetryClass
impl RefUnwindSafe for RetryClass
impl Send for RetryClass
impl Sync for RetryClass
impl Unpin for RetryClass
impl UnsafeUnpin for RetryClass
impl UnwindSafe for RetryClass
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§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.