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
PinnedFieldsOf<__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§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.