Struct sod::RetryService
source · pub struct RetryService<E, S, F>{ /* private fields */ }
Expand description
A Service
, MutService
, or AsyncService
, which encapsulates a Retryable
, blocking and retrying until a value is returned, an un-retryable error is encountered, or the idle function returns an Err
.
When the underlying service’s Service::process
function returns an Err, it is passed to the given Retryable
, which must return an Ok(Input)
to retry or an Err
to return immediately.
Between retries, the given idle
function is called, given the attempt number as input, until Ok(Output)
is returned by the underlying Service
or Err
is returned by the Retryable
or idle
function.
See the idle
module for some provided idle functions.
Implementations§
source§impl<E, S, F> RetryService<E, S, F>
impl<E, S, F> RetryService<E, S, F>
Trait Implementations§
source§impl<S, F> AsyncService for RetryService<S::Error, S, F>
impl<S, F> AsyncService for RetryService<S::Error, S, F>
type Input = <S as AsyncService>::Input
type Output = <S as AsyncService>::Output
type Error = RetryError<<S as AsyncService>::Error>
fn process<'life0, 'async_trait>(
&'life0 self,
input: Self::Input
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
source§impl<S, F> Service for RetryService<S::Error, S, F>
impl<S, F> Service for RetryService<S::Error, S, F>
type Input = <S as Service>::Input
type Output = <S as Service>::Output
type Error = RetryError<<S as Service>::Error>
source§fn process(&self, input: Self::Input) -> Result<Self::Output, Self::Error>
fn process(&self, input: Self::Input) -> Result<Self::Output, Self::Error>
Process an input, producing a
Result<Self::Output, Self::Error>
source§fn into_mut(self) -> ServiceMut<Self>where
Self: Sized,
fn into_mut(self) -> ServiceMut<Self>where
Self: Sized,
source§fn into_dyn<'a>(self) -> DynService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
fn into_dyn<'a>(self) -> DynService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
Convert this
Service
into a DynService
Auto Trait Implementations§
impl<E, S, F> RefUnwindSafe for RetryService<E, S, F>where
F: RefUnwindSafe,
S: RefUnwindSafe,
impl<E, S, F> Send for RetryService<E, S, F>
impl<E, S, F> Sync for RetryService<E, S, F>
impl<E, S, F> Unpin for RetryService<E, S, F>
impl<E, S, F> UnwindSafe for RetryService<E, S, F>where
F: 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
Mutably borrows from an owned value. Read more