4 releases (2 breaking)

0.3.0 Nov 14, 2024
0.2.1 Mar 17, 2023
0.2.0 Aug 18, 2022
0.1.0 Jul 26, 2022

#388 in Asynchronous

Download history 4/week @ 2024-08-26 236/week @ 2024-09-16 254/week @ 2024-09-23 185/week @ 2024-09-30 23/week @ 2024-10-07 136/week @ 2024-10-14 70/week @ 2024-10-21 80/week @ 2024-10-28 84/week @ 2024-11-04 444/week @ 2024-11-11 100/week @ 2024-11-18 95/week @ 2024-11-25 266/week @ 2024-12-02 207/week @ 2024-12-09

747 downloads per month
Used in blobnet

MIT license

9KB
154 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)
    .jitter(true);

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

lib.rs:

Utilities for retrying falliable, asynchronous operations.

Dependencies

~2.3–7.5MB
~52K SLoC