3 unstable releases

0.2.1 Mar 17, 2023
0.2.0 Aug 18, 2022
0.1.0 Jul 26, 2022

#999 in Asynchronous

Download history 27/week @ 2024-03-11 71/week @ 2024-04-01 4/week @ 2024-04-08 13/week @ 2024-05-06 47/week @ 2024-05-13 46/week @ 2024-05-20 106/week @ 2024-05-27 14/week @ 2024-06-03 52/week @ 2024-06-10 60/week @ 2024-06-17 74/week @ 2024-06-24

201 downloads per month
Used in blobnet

MIT license

7KB
117 lines

named-retry

This is a simple, impl Copy utility for retrying fallible asynchronous operations, with helpful log messages through tracing.

use std::time::Duration;
use named_retry::Retry;

let retry = Retry::new("test")
    .attempts(5)
    .base_delay(Duration::from_secs(1))
    .delay_factor(2.0);

let result = retry.run(|| async { Ok::<_, ()>("done!") }).await;
assert_eq!(result, Ok("done!"));

lib.rs:

Utilities for retrying falliable, asynchronous operations.

Dependencies

~2.3–3.5MB
~51K SLoC