[][src]Trait futures_retry::FutureFactory

pub trait FutureFactory {
    type FutureItem: TryFuture;
    fn new(&mut self) -> Self::FutureItem;
}

A factory trait used to create futures.

We need a factory for the retry logic because when (and if) a future returns an error, its internal state is undefined and we can't poll on it anymore. Hence we need to create a new one.

By the way, this trait is implemented for any closure that returns a Future, so you don't have to write your own type and implement it to handle some simple cases.

Associated Types

type FutureItem: TryFuture

An future type that is created by the new method.

Loading content...

Required methods

fn new(&mut self) -> Self::FutureItem

Creates a new future. We don't need the factory to be immutable so we pass self as a mutable reference.

Loading content...

Implementors

impl<T, F> FutureFactory for T where
    T: Unpin + FnMut() -> F,
    F: TryFuture
[src]

type FutureItem = F

Loading content...