| Crates.io | resext |
| lib.rs | resext |
| version | 0.7.0 |
| created_at | 2025-12-26 22:39:55.741758+00 |
| updated_at | 2026-01-18 01:16:09.403113+00 |
| description | A simple, lightweight error handling crate for Rust with no-std support coming soon |
| homepage | |
| repository | https://github.com/Tahaa-Dev/ResExt |
| max_upload_size | |
| id | 2006368 |
| size | 28,592 |
Simple, lightweight, low-alloc error handling crate for Rust.
ResExt provides a declarative macro (ResExt! {}) for easy, ergonomic and performant error-handling.
Add ResExt to your dependencies:
cargo add resext
[dependencies]
resext = "0.7.0"
use resext::ResExt;
ResExt! {
enum MyError {
Io(std::io::Error),
Env(std::env::VarError),
Network(reqwest::Error),
Other,
}
}
This code generates:
MyError enum with Error, Debug and Display implementationsFrom<T> for MyError for types of the enum's tuple variantsResErr struct for context wrapper around MyErrorResExt trait with context methodsRes<T> type alias for Result<T, MyError>use resext::ResExt;
use std::io;
use crate::Data;
ResExt! {
enum ErrorTypes {
Io(io::Error),
Network(reqwest::Error),
Other,
}
}
async fn parse_page(url: String) -> Res<Data> {
let content = reqwest::get(url).await
.with_context(|| format!("Failed to fetch URL: {}", url))?;
let data: Data = crate::parse_page_content(content)
.context("Failed to parse page data")?;
Ok(data)
}
ResExt uses a unique approach for error-handling that provides anyhow methods and convenient error-propagation as well as thiserror's performance and concrete types with a macro that generates both methods and the error enum locally in your project.