generic-err 0.1.0

A small utility library to make errors always serializable and clonable
Documentation
  • Coverage
  • 60%
    9 out of 15 items documented1 out of 13 items with examples
  • Size
  • Source code size: 11.49 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 2.09 MB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 30s Average build duration of successful builds.
  • all releases: 30s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Repository
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • ActuallyHappening

Generic Error

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?

How it works

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

See docs or the examples dir for usage