[][src]Trait futures_retry::FutureFactory

pub trait FutureFactory {
type FutureItem: Future;
    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: Future

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: FnMut() -> F,
    F: Future
[src]

type FutureItem = F

Loading content...