Skip to main content

error_kind/
lib.rs

1#![doc = include_str!("README.md")]
2// =============================================================================
3// CRATE CONFIG
4// =============================================================================
5
6// -----------------------------------------------------------------------------
7#![allow(clippy::module_inception)] // Common pattern for module organization.
8#![cfg_attr(docsrs, feature(doc_cfg))]
9#![cfg_attr(not(feature = "backtrace"), no_std)]
10#![deny(missing_docs)]
11#![deny(rustdoc::broken_intra_doc_links)]
12#![forbid(unsafe_code)]
13
14// =============================================================================
15// CRATES
16// =============================================================================
17
18// -----------------------------------------------------------------------------
19#[cfg(feature = "alloc")]
20extern crate alloc as std_alloc;
21
22// -----------------------------------------------------------------------------
23#[cfg(test)]
24extern crate self as error_kind;
25
26// =============================================================================
27// MODULES
28// =============================================================================
29
30// -----------------------------------------------------------------------------
31pub mod details;
32pub mod envelopes;
33mod macros;
34mod traits;
35
36// =============================================================================
37// RE-EXPORTS
38// =============================================================================
39
40// -----------------------------------------------------------------------------
41pub use traits::*;
42
43// -----------------------------------------------------------------------------
44// These are for *this crate's* macro use only - DO NOT TOUCH! DO NOT DEPEND ON!
45// -----------------------------------------------------------------------------
46#[doc(hidden)]
47pub mod __private {
48    pub use ::core::format_args;
49    #[cfg(feature = "alloc")]
50    pub use ::std_alloc::format;
51}
52
53// -----------------------------------------------------------------------------
54/// Automatically derive the [`Error`] trait
55///
56#[cfg(feature = "macros")]
57#[doc(inline)]
58pub use error_kind_macros::Error;
59
60// -----------------------------------------------------------------------------
61/// Automatically derive the [`ErrorDomain`] trait
62///
63#[cfg(feature = "macros")]
64#[doc(inline)]
65pub use error_kind_macros::ErrorDomain;
66
67// -----------------------------------------------------------------------------
68/// Automatically derive the [`ErrorKind`] trait
69///
70#[cfg(feature = "macros")]
71#[doc(inline)]
72pub use error_kind_macros::ErrorKind;
73
74// -----------------------------------------------------------------------------
75#[cfg(feature = "macros")]
76#[doc = include_str!("macros/error.md")]
77pub use error_kind_macros::error;