[][src]Struct futures_retry::FutureRetry

pub struct FutureRetry<F, R> where
    F: FutureFactory
{ /* fields omitted */ }

A future that transparently launches an underlying future (created by a provided factory each time) as many times as needed to get things done.

It is useful fot situations when you need to make several attempts, e.g. for establishing connections, RPC calls.

There is also a type to handle Stream errors: StreamRetry.#pin_project

Implementations

impl<F: FutureFactory, R> FutureRetry<F, R>[src]

pub fn new(factory: F, error_action: R) -> Self[src]

Creates a FutureRetry using a provided factory and an object of ErrorHandler type that decides on a retry-policy depending on an encountered error.

Please refer to the tcp-client example in the examples folder to have a look at a possible usage.

Arguments

  • factory: a factory that creates futures,
  • error_action: a type that handles an error and decides which route to take: simply try again, wait and then try, or give up (on a critical error for exapmle).

Trait Implementations

impl<F: FutureFactory, R> Future for FutureRetry<F, R> where
    R: ErrorHandler<<F::FutureItem as TryFuture>::Error>, 
[src]

type Output = Result<(<<F as FutureFactory>::FutureItem as TryFuture>::Ok, usize), (R::OutError, usize)>

The type of value produced on completion.

impl<'__pin, F, R> Unpin for FutureRetry<F, R> where
    __Origin<'__pin, F, R>: Unpin,
    F: FutureFactory
[src]

Auto Trait Implementations

impl<F, R> !RefUnwindSafe for FutureRetry<F, R>[src]

impl<F, R> Send for FutureRetry<F, R> where
    F: Send,
    R: Send,
    <F as FutureFactory>::FutureItem: Send
[src]

impl<F, R> Sync for FutureRetry<F, R> where
    F: Sync,
    R: Sync,
    <F as FutureFactory>::FutureItem: Sync
[src]

impl<F, R> !UnwindSafe for FutureRetry<F, R>[src]

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T> FutureExt for T where
    T: Future + ?Sized

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<F> IntoFuture for F where
    F: Future
[src]

type Output = <F as Future>::Output

🔬 This is a nightly-only experimental API. (into_future)

The output that the future will produce on completion.

type Future = F

🔬 This is a nightly-only experimental API. (into_future)

Which kind of future are we turning this into?

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<F, T, E> TryFuture for F where
    F: Future<Output = Result<T, E>> + ?Sized

type Ok = T

The type of successful values yielded by this future

type Error = E

The type of failures yielded by this future

impl<Fut> TryFutureExt for Fut where
    Fut: TryFuture + ?Sized

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.