Crate thiserror_ext
Expand description
Useful extension utilities for thiserror
.
§Painless construction
With derive macros of Construct
, ContextInto
and Macro
,
one can construct an error in a much more convenient way, no matter it’s
from scratch or converted from other errors.
§Better formatting
With extension AsReport
, one can format an error in a pretty and
concise way, without losing any information from the error sources.
§Easier to interact with
With derive macros of Box
and Arc
, one can easily
wrap an enum
error type into a new type, reducing the size to improve
performance, and automatically capturing backtraces if needed.
Structs§
- A wrapper around an error that provides a cleaned up error trace for display and debug formatting.
Traits§
- Extension trait for
Error
that casts the error to a trait object.
Derive Macros§
- Generates a new type that wraps the original error type in an
Arc
. - Generates a new type that wraps the original error type in a [
struct@Box
]. - Generates constructor functions for different variants of the error type.
- Generates extension traits for converting the external error type into the the provided one, with extra context.
- Generates macros for different variants of the error type to construct it or directly bail out.
- Generates the [
Debug
] implementation that delegates to theReport
of an error.