| Crates.io | generic-err |
| lib.rs | generic-err |
| version | 0.1.0 |
| created_at | 2025-04-07 08:36:01.131704+00 |
| updated_at | 2025-04-07 08:36:01.131704+00 |
| description | A small utility library to make errors always serializable and clonable |
| homepage | |
| repository | https://github.com/ActuallyHappening/YMap/tree/master/generic-error |
| max_upload_size | |
| id | 1623817 |
| size | 11,968 |
A simple utility to convert any error type that isn't clonable into one that is,
while preserving source information providing Serialize and Deserialize functionality.
Magic?
The GenericError<E> wrapper type just stores the Display and Debug implementations of the wrapped type,
which is now always clonable and will serialize just fine.
The GenericError<E> type kinda looks like this:
#[derive(Serialize, Deserialize, Clone)]
pub struct GenericError<T>
{
display: String,
debug: String,
source: Option<GenericError>,
}
.. although many details have been omitted for brevity