backtrait_error 2.1.0

Errors with backtraces.
Documentation
  • Coverage
  • 0%
    0 out of 5 items documented0 out of 4 items with examples
  • Size
  • Source code size: 32.34 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 67.82 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • JoshuaXOng/backtrace_error
    0 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • JoshuaXOng

Backtrace/Backtrait Error

Procedural macros to aid the propagation of Backtraces between structs/enums (typically errors).

Dunno if it'd be useful yet.

Gist

Provides function-like procedural macros to: generate a simple trait for facilitating propagating backtraces (the trait is defined where the macro is called); and, generate an enum that contains the backtrace and optional source of the error. See below.

define_backtrace_error!(ErrorWithBacktrace); // Expands into `pub trait ErrorWithBacktrace: std::error::Error {`...

define_backtrace_source!(BacktraceSource, ErrorWithBacktrace);

Provides an attribute procedural macro to derive a simple std::error::Error implementation for structs/enums. See below.

#[backtrace_derive(ErrorWithBacktrace)]
#[derive(Debug, BacktraceError)]
struct UnitError(#[display] String, #[backtrace] BacktraceSource);