mirror of https://github.com/zkat/miette.git
docs: Include #[diagnostic(forward(..)] in documentation (#446)
This commit is contained in:
parent
907857058d
commit
51ca022b1f
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
|
// Use `#[diagnostic(transparent)]` to wrap another [`Diagnostic`]. You won't see labels otherwise
|
||||||
#[diagnostic(transparent)]
|
#[diagnostic(transparent)]
|
||||||
AnotherError(#[from] AnotherError),
|
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)]
|
#[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
|
//! // Use `#[diagnostic(transparent)]` to wrap another [`Diagnostic`]. You won't see labels otherwise
|
||||||
//! #[diagnostic(transparent)]
|
//! #[diagnostic(transparent)]
|
||||||
//! AnotherError(#[from] AnotherError),
|
//! 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)]
|
//! #[derive(Error, Diagnostic, Debug)]
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue