Crate futures_retry [] [src]

A tool that helps you retry your future :)

It's quite a common task when you need to repeat some action if you've got an error, be it a connection timeout or some temporary OS error.

When you do stuff in a synchronous manner it's quite easy to implement the attempts logic, but when it comes to asynchronous programming you suddenly need to write a fool load of a boilerplate code, introduce state machines and everything.

This library aims to make your life easier and let you write more straightword and nice code, concentrating on buisness logic rathen than on handling all the mess.

I was inspired to write this library after coming over a hyper issue, and I came to an understanding that the problem is more common than I used to think.

Suggestions and critiques are welcome!

Structs

FutureRetry

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

StreamRetry

Provides a way to handle errors during a Stream execution, i.e. it gives you an ability to poll for future stream's items with a delay.

Enums

RetryPolicy

What to do when a future returns an error. Used in FutureRetry::new and StreamRetry::new.

Traits

FutureFactory

A factory trait used to create futures.

StreamRetryExt

An extention trait for Stream which allows to use StreamRetry in a chain-like manner.