| Crates.io | named-retry |
| lib.rs | named-retry |
| version | 0.4.0 |
| created_at | 2022-07-26 21:00:17.966673+00 |
| updated_at | 2025-02-26 05:35:59.197783+00 |
| description | A simple utility for retrying fallible asynchronous operations. |
| homepage | |
| repository | https://github.com/modal-labs/named-retry |
| max_upload_size | |
| id | 633403 |
| size | 14,208 |
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!"));