pub struct DefaultRetryPolicy<'a> { /* private fields */ }
Expand description
A simple default retry policy. This will retry using the given ExponentialBackoff
if
the error matches one of the following status codes:
- StatusCode::BadUnexpectedError
- StatusCode::BadInternalError
- StatusCode::BadOutOfMemory
- StatusCode::BadResourceUnavailable
- StatusCode::BadCommunicationError
- StatusCode::BadTimeout
- StatusCode::BadShutdown
- StatusCode::BadServerNotConnected
- StatusCode::BadServerHalted
- StatusCode::BadNonceInvalid
- StatusCode::BadSessionClosed
- StatusCode::BadSessionIdInvalid
- StatusCode::BadSessionNotActivated
- StatusCode::BadNoCommunication
- StatusCode::BadTooManySessions
- StatusCode::BadTcpServerTooBusy
- StatusCode::BadTcpSecureChannelUnknown
- StatusCode::BadTcpNotEnoughResources
- StatusCode::BadTcpInternalError
- StatusCode::BadSecureChannelClosed
- StatusCode::BadSecureChannelIdInvalid
- StatusCode::BadNotConnected
- StatusCode::BadDeviceFailure
- StatusCode::BadSensorFailure
- StatusCode::BadDisconnect
- StatusCode::BadConnectionClosed
- StatusCode::BadEndOfStream
- StatusCode::BadInvalidState
- StatusCode::BadMaxConnectionsReached
- StatusCode::BadConnectionRejected
or if it’s in the configured extra_status_codes
.
Implementations§
Source§impl<'a> DefaultRetryPolicy<'a>
impl<'a> DefaultRetryPolicy<'a>
Sourcepub fn new(backoff: ExponentialBackoff) -> Self
pub fn new(backoff: ExponentialBackoff) -> Self
Create a new default retry policy with the given backoff generator.
Sourcepub fn new_with_extras(
backoff: ExponentialBackoff,
extra_status_codes: &'a [StatusCode],
) -> Self
pub fn new_with_extras( backoff: ExponentialBackoff, extra_status_codes: &'a [StatusCode], ) -> Self
Create a retry policy with extra status codes to retry.
Trait Implementations§
Source§impl<'a> Clone for DefaultRetryPolicy<'a>
impl<'a> Clone for DefaultRetryPolicy<'a>
Source§fn clone(&self) -> DefaultRetryPolicy<'a>
fn clone(&self) -> DefaultRetryPolicy<'a>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl RequestRetryPolicy for DefaultRetryPolicy<'_>
impl RequestRetryPolicy for DefaultRetryPolicy<'_>
Source§fn get_next_delay(&mut self, status: StatusCode) -> Option<Duration>
fn get_next_delay(&mut self, status: StatusCode) -> Option<Duration>
Return the time until the next retry, or
None
if no more retries should be attempted.Auto Trait Implementations§
impl<'a> Freeze for DefaultRetryPolicy<'a>
impl<'a> RefUnwindSafe for DefaultRetryPolicy<'a>
impl<'a> Send for DefaultRetryPolicy<'a>
impl<'a> Sync for DefaultRetryPolicy<'a>
impl<'a> Unpin for DefaultRetryPolicy<'a>
impl<'a> UnwindSafe for DefaultRetryPolicy<'a>
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
Mutably borrows from an owned value. Read more