[][src]Trait futures_retrying::Retryable

pub trait Retryable {
    type Item;
    type Error: Debug;
    type Future: Future<Output = Result<Self::Item, Self::Error>>;
    fn call(&self) -> Self::Future;

    fn report_error(&self, error: &Self::Error, next_retry: Option<Duration>) { ... }
}

Retryable must be implemented for a task that can be retried any number of times.

All errors wil be reported with report_error. The default implementation will report the error with tracing::error!().

Associated Types

type Item

type Error: Debug

type Future: Future<Output = Result<Self::Item, Self::Error>>

Loading content...

Required methods

fn call(&self) -> Self::Future

Setup a new attempt at completing the task.

Loading content...

Provided methods

fn report_error(&self, error: &Self::Error, next_retry: Option<Duration>)

Report the error of the last attempt to complete the task.

Loading content...

Implementors

impl<F, Fut, I, E> Retryable for F where
    F: Fn() -> Fut,
    Fut: Future<Output = Result<I, E>>,
    E: Debug
[src]

type Item = I

type Error = E

type Future = Fut

Loading content...