tokio-retry

Extensible, asynchronous retry behaviours based on futures, for the ecosystem of tokio libraries.

crates

Documentation

Installation

Add this to your Cargo.toml:

toml [dependencies] tokio-retry = "0.1"

Examples

```rust extern crate tokiocore; extern crate tokioretry;

use tokiocore::reactor::Core; use tokioretry::Retry; use tokio_retry::strategy::{ExponentialBackoff, jitter};

fn action() -> Result

fn main() { let mut core = Core::new().unwrap();

let retry_strategy = ExponentialBackoff::from_millis(10)
    .map(jitter)
    .take(3);

let retry_future = Retry::spawn(core.handle(), retry_strategy, action);
let retry_result = core.run(retry_future);

assert_eq!(retry_result, Ok(42));

} ```