Commit 8ad9481 1 parent 6b7f431 commit 8ad9481 Copy full SHA for 8ad9481
File tree 1 file changed +22
-0
lines changed
1 file changed +22
-0
lines changed Original file line number Diff line number Diff line change 101
101
//! }
102
102
//! ```
103
103
//!
104
+ //! ## Deriving traits for generated enum
105
+ //! You can annotate the function with `#[derive]` to derive traits for the generated enum.
106
+ //! Note that the `#[derive]` macro must be used after the `errors` macro. (techically in `impl`
107
+ //! blocks the order doesnt matter, but we recommend using `#[derive]` after `errors` for consistency.)
108
+ //! ```rust
109
+ //! # use error_mancer::prelude::*;
110
+ //! # use thiserror::Error;
111
+ //! # #[derive(Error, Debug, Clone)]
112
+ //! # #[error("1")]
113
+ //! # struct Err1;
114
+ //!
115
+ //! #[errors(Err1)]
116
+ //! #[derive(Clone)]
117
+ //! fn foo() -> Result<(), _> {
118
+ //! Ok(())
119
+ //! }
120
+ //!
121
+ //! fn bar() {
122
+ //! let _ = foo().clone();
123
+ //! }
124
+ //! ```
125
+ //!
104
126
//! ## Specifics and Implementation Details
105
127
//!
106
128
//! ### Error Type Overwriting
You can’t perform that action at this time.
0 commit comments