pub struct RetryBackend { /* private fields */ }Expand description
An HttpBackend that retries requests through an inner backend per a RetryPolicy.
It takes effect only when a caller wraps their backend in it and installs it via
Client::with_backend. See this module’s docs for the timing and cloneability contracts.
A request’s super::TotalTimeout bounds each attempt, not the whole retried call: every
replay carries the same extension to the inner backend, and the policy’s backoff runs between
attempts outside any of them. A call retried n times may therefore take n + 1 timeouts plus
the backoffs; a policy that must meet an overall deadline stops retrying once its waits would
pass it.
Implementations§
Source§impl RetryBackend
impl RetryBackend
Sourcepub fn new(inner: Arc<dyn HttpBackend>, policy: Arc<dyn RetryPolicy>) -> Self
pub fn new(inner: Arc<dyn HttpBackend>, policy: Arc<dyn RetryPolicy>) -> Self
Wrap inner so requests are retried according to policy.
Sourcepub fn inner(&self) -> &Arc<dyn HttpBackend> ⓘ
pub fn inner(&self) -> &Arc<dyn HttpBackend> ⓘ
The wrapped inner backend.
Trait Implementations§
Source§impl Clone for RetryBackend
impl Clone for RetryBackend
Source§fn clone(&self) -> RetryBackend
fn clone(&self) -> RetryBackend
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for RetryBackend
impl Debug for RetryBackend
Source§impl HttpBackend for RetryBackend
impl HttpBackend for RetryBackend
Source§fn execute(&self, request: Request<HttpBody>) -> ExecuteFuture<'_>
fn execute(&self, request: Request<HttpBody>) -> ExecuteFuture<'_>
Execute a prepared request, yielding the raw response or a transport failure. The request’s
URI is absolute. A backend that fails builds its
TransportError with the constructor
naming the failure’s class, so the runtime’s send maps it to the right super::Error
variant. Read moreAuto Trait Implementations§
impl !RefUnwindSafe for RetryBackend
impl !UnwindSafe for RetryBackend
impl Freeze for RetryBackend
impl Send for RetryBackend
impl Sync for RetryBackend
impl Unpin for RetryBackend
impl UnsafeUnpin for RetryBackend
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<T> CompatExt for T
impl<T> CompatExt for T
§impl<T, UT> HandleAlloc<UT> for T
impl<T, UT> HandleAlloc<UT> for T
§fn new_handle(value: Arc<T>) -> Handle
fn new_handle(value: Arc<T>) -> Handle
Create a new handle for an Arc value Read more
§unsafe fn clone_handle(handle: Handle) -> Handle
unsafe fn clone_handle(handle: Handle) -> Handle
Clone a handle Read more
§unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
unsafe fn consume_handle(handle: Handle) -> Arc<T> ⓘ
Consume a handle, getting back the initial
Arc<> Read more§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>
Converts
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>
Converts
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