this-error-from-box (vibe-coded)
This crate provides a procedural macro for Rust that automatically generates From<T> implementations for error enums annotated with #[this_error_from_box] and variants containing #[from] Box<T>.
You can optionally specify a custom wrapper type as an argument, e.g. #[this_error_from_box(MyWrapper)]. If omitted, Box is used by default.
Example
use Error;
use this_error_from_box;
This will automatically generate the following implementations:
Installation
Notes
- The macro only works for variants with exactly one field of type
Box<T>and the attribute#[from]. - No
From<T>implementation is generated for other variants.