[][src]Trait tryhard::OnRetry

pub trait OnRetry<E> {
    type Future: 'static + Future<Output = Self::Output> + Send;
    type Output: 'static + Send;
    pub fn on_retry(
        &mut self,
        attempt: u32,
        next_delay: Option<Duration>,
        previous_error: &E
    ) -> Self::Future; }

Trait allowing you to run some future when a retry occurs. Could for example to be used for logging or other kinds of telemetry.

You wont have to implement this trait manually. It is implemented for functions with the right signature. See RetryFuture::on_retry for more details.

Associated Types

type Future: 'static + Future<Output = Self::Output> + Send[src]

The type of the future you want to run.

type Output: 'static + Send[src]

The output type of your future.

Loading content...

Required methods

pub fn on_retry(
    &mut self,
    attempt: u32,
    next_delay: Option<Duration>,
    previous_error: &E
) -> Self::Future
[src]

Create another future to run.

If next_delay is None then your future is out of retries and wont be called again.

Loading content...

Implementors

impl<E> OnRetry<E> for NoOnRetry[src]

type Future = Ready<Infallible>

type Output = Infallible

impl<F, E, FutureT> OnRetry<E> for F where
    F: FnMut(u32, Option<Duration>, &E) -> FutureT,
    FutureT: Future + Send + 'static,
    FutureT::Output: Send + 'static, 
[src]

type Output = FutureT::Output

type Future = FutureT

Loading content...