pub fn run<F, R>(self, try_it: F) -> impl Future<Item = I, Error = TimeoutError<E>>
    where
        F: Fn() -> R + Send,
        R: Future<Item = I, Error = E> + Send,
    {
        use futures03::future::TryFutureExt;

        let operation_name = self.inner.operation_name;
        let logger = self.inner.logger.clone();
        let condition = self.inner.condition;
        let log_after = self.inner.log_after;
        let limit_opt = self.inner.limit.unwrap(&operation_name, "limit");
        let timeout = self.timeout;

        trace!(logger, "Run with retry: {}", operation_name);

        run_retry(
            operation_name,
            logger,
            condition,
            log_after,
            limit_opt,
            move || {
                try_it()
                    .timeout(timeout)
                    .map_err(|_| TimeoutError::Elapsed)
                    .and_then(|res| futures03::future::ready(res.map_err(TimeoutError::Inner)))
                    .compat()
            },
        )
    }
/// Rerun the provided function as many times as needed.
Rerun the provided function as many times as needed.
Rerun the provided function as many times as needed .
pub fn run<F, R>(self, try_it: F) -> impl Future<Item = I, Error = TimeoutError<E>>
    where
        F: Fn() -> R + Send,
        R: Future<Item = I, Error = E> + Send,
    {
        use futures03::future::TryFutureExt;
        let operation_name = self.inner.operation_name;
        let logger = self.inner.logger.clone();
        let condition = self.inner.condition;
        let log_after = self.inner.log_after;
        let limit_opt = self.inner.limit.unwrap(&operation_name, "limit");
        let timeout = self.timeout;
        trace!(logger, "Run with retry: {}", operation_name);
        run_retry(
            operation_name,
            logger,
            condition,
            log_after,
            limit_opt,
            move || {
                try_it()
                    .timeout(timeout)
                    .map_err(|_| TimeoutError::Elapsed)
                    .and_then(|res| futures03::future::ready(res.map_err(TimeoutError::Inner)))
                    .compat()
            },
        )
    }
pub fn run < F , R > ( self , try_it : F ) -> impl Future < Item = I , Error = TimeoutError < E > > where F : Fn ( ) -> R + Send , R : Future < Item = I , Error = E > + Send , { use futures03 :: future :: TryFutureExt ; let operation_name = self . inner . operation_name ; let logger = self . inner . logger . clone ( ) ; let condition = self . inner . condition ; let log_after = self . inner . log_after ; let limit_opt = self . inner . limit . unwrap ( & operation_name , " " ) ; let timeout = self . timeout ; trace ! ( logger " " operation_name ) ; run_retry ( operation_name , logger , condition , log_after , limit_opt , move | | { try_it ( ) . timeout ( timeout ) . map_err ( | _ | TimeoutError :: Elapsed ) . and_then ( | res | futures03 :: future :: ready ( res . map_err ( TimeoutError :: Inner ) ) ) . compat ( ) } , ) }
Rerun the provided function as many times as needed.
Rerun the provided function as many times as needed .
self
try_it
F
self
try_it
F