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