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§
- Report
- A wrapper around an error that provides a cleaned up error trace for display and debug formatting.
Traits§
- AsDyn
- Extension trait for
Errorthat casts the error to a trait object. - AsReport
- Extension trait for
Errorthat provides aReportwhich formats the error and its sources in a cleaned-up way.
Derive Macros§
- Arc
- Generates a new type that wraps the original error type in an
Arc. - Box
- Generates a new type that wraps the original error type in a [
struct@Box]. - Construct
- Generates constructor functions for different variants of the error type.
- Context
Into - Generates extension traits for converting the external error type into the the provided one, with extra context.
- Macro
- Generates macros for different variants of the error type to construct it or directly bail out.
- Report
Debug - Generates the [
Debug] implementation that delegates to theReportof an error.