pub struct PollService<E, S, F>{ /* private fields */ }Expand description
A Service, MutService, or AsyncService, which encapsulates a Service<(), Output = Option<T>>, MutService<(), Output = Option<T>>, or AsyncService<(), Output = Option<T>>, blocking with the given idle function until a value is returned or the idle function returns an error.
When the underlying Service<()> returns None, the given idle function will be called.
The idle function will be called repeatedly, given the attempt number as input, until Some(T) is returned by the underlying service.
The idle function may return Err(RetryError::Interrupted) to return an error and avoid blocking forever.
See the idle module for some provided idle functions.
Implementations§
Source§impl<E, S, F> PollService<E, S, F>
impl<E, S, F> PollService<E, S, F>
Trait Implementations§
Source§impl<O, E, S, F> AsyncService for PollService<E, S, F>
impl<O, E, S, F> AsyncService for PollService<E, S, F>
type Input = ()
type Output = O
type Error = RetryError<<S as AsyncService>::Error>
fn process<'life0, 'async_trait>(
&'life0 self,
__arg1: (),
) -> Pin<Box<dyn Future<Output = Result<Self::Output, Self::Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Source§impl<O, E, S, F> MutService for PollService<E, S, F>where
S: MutService<Input = (), Output = Option<O>, Error = E>,
F: Fn(usize) -> Result<(), RetryError<E>>,
impl<O, E, S, F> MutService for PollService<E, S, F>where
S: MutService<Input = (), Output = Option<O>, Error = E>,
F: Fn(usize) -> Result<(), RetryError<E>>,
type Input = ()
type Output = O
type Error = RetryError<<S as MutService>::Error>
fn process(&mut self, _: ()) -> Result<Self::Output, Self::Error>
Source§fn into_dyn<'a>(
self,
) -> DynMutService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
fn into_dyn<'a>(
self,
) -> DynMutService<'a, Self::Input, Self::Output, Self::Error>where
Self: Sized + 'static,
Convert this
Service into a DynMutServiceSource§impl<O, E, S, F> Service for PollService<E, S, F>
impl<O, E, S, F> Service for PollService<E, S, F>
type Input = ()
type Output = O
type Error = RetryError<<S as Service>::Error>
Source§fn process(&self, _: ()) -> Result<Self::Output, Self::Error>
fn process(&self, _: ()) -> 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_async(self) -> ServiceAsync<Self>
fn into_async(self) -> ServiceAsync<Self>
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 DynServiceAuto Trait Implementations§
impl<E, S, F> Freeze for PollService<E, S, F>
impl<E, S, F> RefUnwindSafe for PollService<E, S, F>where
S: RefUnwindSafe,
F: RefUnwindSafe,
impl<E, S, F> Send for PollService<E, S, F>
impl<E, S, F> Sync for PollService<E, S, F>
impl<E, S, F> Unpin for PollService<E, S, F>
impl<E, S, F> UnwindSafe for PollService<E, S, F>where
S: UnwindSafe,
F: 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