# Decrust 🦀⚡
**The Ultimate All-in-One Error Handling Framework for Rust*
[](https://crates.io/crates/decrust)
[](https://docs.rs/decrust)
[](LICENSE)
Decrust is a revolutionary error handling framework that transforms how you deal with errors in Rust. With **96% automation rate**, intelligent autocorrection, and comprehensive error analysis, Decrust makes error handling effortless and robust.
## 🚀 Quick Start
Add Decrust to your `Cargo.toml`:
```toml
[dependencies]
decrust = "1.2"
```
Use the `decrust!` macro for automatic error handling:
```rust
use decrust::*;
fn any_operation() -> Result<String> {
Ok("Success!".to_string())
}
fn main() -> Result<()> {
let result = decrust!(any_operation());
// 96% of errors are automatically fixed with M.A.R.S. system
// CrossModuleAutomationEngine + CircuitBreakerProtection + HeuristicRecovery
Ok(())
}
```
## ✨ Revolutionary Features
### 🎯 **96% AUTOMATION RATE**
- **✅ 22/23 error types** fixed automatically with zero human intervention
- **✅ AST-driven fixes** with deep syntax tree analysis
- **✅ Circuit breaker protection** prevents automation failures
- **✅ Heuristic recovery** with pattern learning and confidence scoring
### 🔥 **What `decrust!` Can Handle**
- **File I/O operations** – automatic error detection & reporting
- **Network requests** – with circuit breakers and heuristic recovery
- **Database calls** – includes retry and backoff logic
- **Parsing operations** – with inline validation & recovery
- **Memory & threading issues** – auto-sanitized with cross-module automation
- **Async/await** – seamlessly supported with circuit breaker protection
- **Missing imports (E0433)** – 100% automated dependency resolution
- **Division by zero** – 100% automated safety checks
- **Type mismatches** – smart automation with manual fallback
- **Borrow checker errors** – heuristic recovery with pattern recognition
### 💎 **Advanced Error Handling**
```rust
use decrust::*;
fn complex_operation() -> Result<String> {
// File operations with automatic error handling
let config = decrust!(std::fs::read_to_string("config.toml"));
// Rich error context
let data = std::fs::read_to_string("data.txt")
.decrust_context_msg("Loading application data")?;
// Validation with automatic suggestions
if data.is_empty() {
return Err(validation_error!("data", "Data cannot be empty"));
}
Ok("Success".to_string())
}
```
## 🎯 What Problems Does Decrust Solve?
### Before Decrust
```rust
// Manual error handling - verbose and error-prone
match std::fs::read_to_string("config.toml") {
Ok(content) => {
match toml::from_str::<Config>(&content) {
Ok(config) => {
// Finally use the config...
}
Err(e) => {
eprintln!("Parse error: {}", e);
std::process::exit(1);
}
}
}
Err(e) => {
eprintln!("File error: {}", e);
std::process::exit(1);
}
}
```
### After Decrust
```rust
// Automatic error handling - clean and robust
use decrust::*;
decrust! {
let config: Config = std::fs::read_to_string("config.toml")?
.parse()?;
// Use config directly - all errors handled automatically!
}
```
## 📚 Documentation
- **[API Documentation](https://docs.rs/decrust)** - Complete API reference
- **[User Guide](https://github.com/arcmoonstudios/decrust/wiki)** - Comprehensive tutorials
- **[Examples](examples/)** - Real-world usage examples
## 🏗️ Architecture
Decrust consists of several integrated components:
- **`decrust-core`** - Core error handling framework
- **`decrust-promac-runtime`** - Runtime middleware and utilities
- **`decrust_promac`** - Procedural macros and code generation
- **`decrust`** - Main public interface (this crate)
## 🛡️ Licensing
This project is licensed under the **Business Source License 1.1 (BSL 1.1)**.
- **✅ Non-production use is FREE** (development, testing, academic, personal)
- **💰 Commercial/production use requires a paid license** from ArcMoon Studios
- **📧 Contact**: LordXyn@proton.me for commercial licensing inquiries
## 🤝 Contributing
We welcome contributions! Please see our [Contributing Guide](../CONTRIBUTING.md) for details.
## 📞 Support
- **Issues**: [GitHub Issues](https://github.com/arcmoonstudios/decrust/issues)
- **Discussions**: [GitHub Discussions](https://github.com/arcmoonstudios/decrust/discussions)
- **Commercial Support** LordXyn@proton.me
---
**Made with ❤️ by [ArcMoon Studios](https://github.com/arcmoonstudios)**