1#![cfg_attr(feature = "backtrace", feature(error_generic_member_access))]
21
22mod as_dyn;
23mod backtrace;
24mod ptr;
25mod report;
26
27pub use as_dyn::AsDyn;
28pub use report::{AsReport, Report};
29pub use thiserror_ext_derive::*;
30
31#[doc(hidden)]
32pub mod __private {
33 #[cfg(feature = "backtrace")]
34 pub use crate::backtrace::MaybeBacktrace;
35 pub use crate::backtrace::NoExtraBacktrace;
36 pub use crate::ptr::{ErrorArc, ErrorBox};
37 pub use thiserror;
38}
39
40macro_rules! for_dyn_error_types {
41 ($macro:ident) => {
42 $macro! {
43 { dyn std::error::Error },
44 { dyn std::error::Error + Send },
45 { dyn std::error::Error + Sync },
46 { dyn std::error::Error + Send + Sync },
47 { dyn std::error::Error + Send + Sync + std::panic::UnwindSafe },
48 }
49 };
50}
51pub(crate) use for_dyn_error_types;
52
53pub(crate) mod error_sealed {
54 pub trait Sealed {}
55
56 impl<T: std::error::Error> Sealed for T {}
57
58 macro_rules! impl_sealed {
59 ($({$ty:ty },)*) => {
60 $(
61 impl Sealed for $ty {}
62 )*
63 };
64 }
65 for_dyn_error_types! { impl_sealed }
66}