pub struct Retry<P, S> { /* private fields */ }retry only.Expand description
Configure retrying requests of “failed” responses.
A Policy classifies what is a “failed” response.
§Clone
This middleware requires that the inner Service implements Clone,
because the Service must be stored in each ResponseFuture in
order to retry the request in the event of a failure. If the inner
Service type does not implement Clone, the Buffer middleware
can be added to make any Service cloneable.
The Policy must also implement Clone. This middleware will
clone the policy for each request session. This means a new clone
of the policy will be created for each initial request and any subsequent
retries of that request. Therefore, any state stored in the Policy instance
is for that request session only. In order to share data across request
sessions, that shared state may be stored in an Arc, so that all clones
of the Policy type reference the same instance of the shared state.
Implementations§
Trait Implementations§
source§impl<P, S, Request> Service<Request> for Retry<P, S>
impl<P, S, Request> Service<Request> for Retry<P, S>
impl<'__pin, P, S> Unpin for Retry<P, S>where
__Origin<'__pin, P, S>: Unpin,
Auto Trait Implementations§
impl<P, S> Freeze for Retry<P, S>
impl<P, S> RefUnwindSafe for Retry<P, S>where
P: RefUnwindSafe,
S: RefUnwindSafe,
impl<P, S> Send for Retry<P, S>
impl<P, S> Sync for Retry<P, S>
impl<P, S> UnwindSafe for Retry<P, S>where
P: UnwindSafe,
S: 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
source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit)source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
source§impl<M, S, Target, Request> MakeService<Target, Request> for M
impl<M, S, Target, Request> MakeService<Target, Request> for M
source§type Response = <S as Service<Request>>::Response
type Response = <S as Service<Request>>::Response
make only.source§type Error = <S as Service<Request>>::Error
type Error = <S as Service<Request>>::Error
make only.source§type Service = S
type Service = S
make only.Service value created by this factorysource§type MakeError = <M as Service<Target>>::Error
type MakeError = <M as Service<Target>>::Error
make only.source§type Future = <M as Service<Target>>::Future
type Future = <M as Service<Target>>::Future
make only.Service instance.source§fn poll_ready(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
fn poll_ready( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>
make only.Poll::Ready when the factory is able to create more services. Read moresource§fn make_service(
&mut self,
target: Target,
) -> <M as MakeService<Target, Request>>::Future
fn make_service( &mut self, target: Target, ) -> <M as MakeService<Target, Request>>::Future
make only.source§fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
fn into_service(self) -> IntoService<Self, Request>where
Self: Sized,
make only.source§fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
fn as_service(&mut self) -> AsService<'_, Self, Request>where
Self: Sized,
make only.source§impl<T, Request> ServiceExt<Request> for T
impl<T, Request> ServiceExt<Request> for T
source§fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
fn ready(&mut self) -> Ready<'_, Self, Request> ⓘwhere
Self: Sized,
util only.source§fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
fn ready_oneshot(self) -> ReadyOneshot<Self, Request> ⓘwhere
Self: Sized,
util only.source§fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
fn oneshot(self, req: Request) -> Oneshot<Self, Request> ⓘwhere
Self: Sized,
util only.Service, calling it with the provided request once it is ready.source§fn and_then<F>(self, f: F) -> AndThen<Self, F>
fn and_then<F>(self, f: F) -> AndThen<Self, F>
util only.poll_ready method. Read moresource§fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
fn map_response<F, Response>(self, f: F) -> MapResponse<Self, F>
util only.poll_ready method. Read moresource§fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
fn map_err<F, Error>(self, f: F) -> MapErr<Self, F>
util only.poll_ready method. Read moresource§fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
fn map_result<F, Response, Error>(self, f: F) -> MapResult<Self, F>
util only.Result<Self::Response, Self::Error>)
to a different value, regardless of whether the future succeeds or
fails. Read moresource§fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
fn map_request<F, NewRequest>(self, f: F) -> MapRequest<Self, F>
util only.source§fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>
fn filter<F, NewRequest>(self, filter: F) -> Filter<Self, F>
util and filter only.source§fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
fn filter_async<F, NewRequest>(self, filter: F) -> AsyncFilter<Self, F>where
Self: Sized,
F: AsyncPredicate<NewRequest>,
util and filter only.AsyncFilter that conditionally accepts or
rejects requests based on an [async predicate]. Read moresource§fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
fn then<F, Response, Error, Fut>(self, f: F) -> Then<Self, F>
util only.source§fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
fn map_future<F, Fut, Response, Error>(self, f: F) -> MapFuture<Self, F>
util only.