mirror of https://github.com/zkat/miette.git
Include #[diagnostic(forward(..)] in documentation
This commit is contained in:
parent
907857058d
commit
1e4ba14098
11
README.md
11
README.md
|
|
@ -211,6 +211,17 @@ pub enum MyLibError {
|
|||
// Use `#[diagnostic(transparent)]` to wrap another [`Diagnostic`]. You won't see labels otherwise
|
||||
#[diagnostic(transparent)]
|
||||
AnotherError(#[from] AnotherError),
|
||||
|
||||
/// Forward the diagnostic to a particular field.
|
||||
#[error("other error")]
|
||||
#[diagnostic(forward(the_actual_diagnostic))]
|
||||
EvenMoreData {
|
||||
unrelated_field_1: String,
|
||||
unrelated_field_2: usize,
|
||||
|
||||
#[source]
|
||||
the_actual_diagnostic: AnotherError,
|
||||
}
|
||||
}
|
||||
|
||||
#[derive(Error, Diagnostic, Debug)]
|
||||
|
|
|
|||
11
src/lib.rs
11
src/lib.rs
|
|
@ -211,6 +211,17 @@
|
|||
//! // Use `#[diagnostic(transparent)]` to wrap another [`Diagnostic`]. You won't see labels otherwise
|
||||
//! #[diagnostic(transparent)]
|
||||
//! AnotherError(#[from] AnotherError),
|
||||
//!
|
||||
//! /// Forward the diagnostic to a particular field.
|
||||
//! #[error("other error")]
|
||||
//! #[diagnostic(forward(the_actual_diagnostic))]
|
||||
//! EvenMoreData {
|
||||
//! unrelated_field_1: String,
|
||||
//! unrelated_field_2: usize,
|
||||
//!
|
||||
//! #[source]
|
||||
//! the_actual_diagnostic: AnotherError,
|
||||
//! }
|
||||
//! }
|
||||
//!
|
||||
//! #[derive(Error, Diagnostic, Debug)]
|
||||
|
|
|
|||
Loading…
Reference in New Issue