Skip to main content

backoff_config/
lib.rs

1//! # 🔄 `backoff-config` ⚙️
2//!
3//! [![codecov](https://codecov.io/github/yevtyushkin/backoff-config/graph/badge.svg?token=TKF2NSE4IT)](https://codecov.io/github/yevtyushkin/backoff-config)
4//!
5//! This crate enables declarative configuration of [backon](https://crates.io/crates/backon) retry crate strategies via
6//! environment variables or configuration files by:
7//!
8//! - Unifying the backoff strategies provided by the [backon](https://crates.io/crates/backon) retry crate into a single
9//!   enum (see [BackoffConfig]).
10//!
11//! - Implementing [serde::Deserialize] to support loading strategies from various
12//!   configuration sources. [std::time::Duration] values are deserialized using human-readable formats (e.g. `5s`, `150 ms`).
13//!
14//! See [examples](https://github.com/yevtyushkin/backoff-config/tree/main/examples) and [tests](https://github.com/yevtyushkin/backoff-config/tree/main/tests) for example configuration formats.
15mod backoff;
16mod backoff_config;
17
18pub use crate::backoff::*;
19pub use crate::backoff_config::*;