A Rust utility library for fault tolerance, including retry strategies, backoff mechanisms, failure handling and much more.
π Loved the work? Subscribe to my YouTube channel or consider giving this repository a β to show your support!
Feature Overview
| Feature | Details | Status |
|---|---|---|
| Retry | Basic retry functionality | β Stable |
| With Backoff (exponential) | β Stable | |
| With Fallback | β Stable | |
| Execute | Execute Operation with a timeout and fallback | β Stable |
| Circuit Breaker | Prevents cascading failures | π οΈ Planned |
| Memoize | Future Cache | π οΈ Planned |
| Logging | Comprehensive debugging support | β Stable |
| More Examples | Additional usage examples | π οΈ Planned |
Notes:
- Supported Contexts: All features are available for both synchronous and asynchronous operations.
Runtime Compatibility
This library is designed to be compatible with multiple Rust async runtimes. The resilient_rs::asynchronous mod works seamlessly with:
- Tokio - Using Tokio's async I/O and runtime
- async-std - Using async-std's lightweight async runtime
- futures - Using the core futures crate with blocking execution
π¦ How to Use resilient-rs
Hereβs a quick example of how to use the resilient-rs crate in your Rust project.
1οΈβ£ Add resilient-rs to Your Cargo.toml
Add the following line to your Cargo.toml file:
[]
= "0.4.4" # Replace with the latest version
OR
Synchronous
use Duration;
use RetryConfig;
use retry;
Asynchronous
use Duration;
use Client;
use retry;
use RetryConfig;
async
async
π Contributing Guidelines
We welcome your contributions! Here's how to get started:
π Issues & π Features
- Find an issue or planned feature you'd like to work on.
- Comment on the issue (or create one for planned features) and tag me (
@semicolon-10) for assignment.
π‘ Tip: Ensure it's not already assigned! - Once assigned, start working. π
π§ Submitting Work
- π΄ Fork the repo and create a new branch.
- π οΈ Make changes and test thoroughly.
- β Ensure git actions pass before tagging me for review.
- π€ Submit a PR with a clear description and link the issue.
π€ Code of Conduct
- Be respectful and collaborative. π€
- Follow coding standards and guidelines. β