Struct Retry
struct Retry<P, S> { ... }
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
impl<P, S> Retry<P, S>
const fn new(policy: P, service: S) -> SelfRetry the inner service depending on this
Policy.fn get_ref(self: &Self) -> &SGet a reference to the inner service
fn get_mut(self: &mut Self) -> &mut SGet a mutable reference to the inner service
fn into_inner(self: Self) -> SConsume
self, returning the inner service
impl<'__pin, P, S> Unpin for Retry<P, S>
impl<M, S, Target, Request> MakeService for Retry<P, S>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <M as MakeService<Target, Request>>::MakeError>>fn make_service(self: &mut Self, target: Target) -> <M as MakeService<Target, Request>>::Future
impl<P, S> Freeze for Retry<P, S>
impl<P, S> RefUnwindSafe for Retry<P, S>
impl<P, S> Send for Retry<P, S>
impl<P, S> Sync for Retry<P, S>
impl<P, S> UnwindSafe for Retry<P, S>
impl<P, S, Request> Service for Retry<P, S>
fn poll_ready(self: &mut Self, cx: &mut Context<'_>) -> Poll<Result<(), <Self as >::Error>>fn call(self: &mut Self, request: Request) -> <Self as >::Future
impl<P: $crate::clone::Clone, S: $crate::clone::Clone> Clone for Retry<P, S>
fn clone(self: &Self) -> Retry<P, S>
impl<P: $crate::fmt::Debug, S: $crate::fmt::Debug> Debug for Retry<P, S>
fn fmt(self: &Self, f: &mut $crate::fmt::Formatter<'_>) -> $crate::fmt::Result
impl<T> Any for Retry<P, S>
fn type_id(self: &Self) -> TypeId
impl<T> Borrow for Retry<P, S>
fn borrow(self: &Self) -> &T
impl<T> BorrowMut for Retry<P, S>
fn borrow_mut(self: &mut Self) -> &mut T
impl<T> CloneToUninit for Retry<P, S>
unsafe fn clone_to_uninit(self: &Self, dest: *mut u8)
impl<T> From for Retry<P, S>
fn from(t: T) -> TReturns the argument unchanged.
impl<T> Instrument for Retry<P, S>
impl<T> ToOwned for Retry<P, S>
fn to_owned(self: &Self) -> Tfn clone_into(self: &Self, target: &mut T)
impl<T> WithSubscriber for Retry<P, S>
impl<T, Request> ServiceExt for Retry<P, S>
impl<T, U> Into for Retry<P, S>
fn into(self: Self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom for Retry<P, S>
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
impl<T, U> TryInto for Retry<P, S>
fn try_into(self: Self) -> Result<U, <U as TryFrom<T>>::Error>