mirror of https://github.com/zkat/miette.git
docs: use `cargo readme` to update (#351)
This commit is contained in:
parent
62cfd221ba
commit
22b29eec38
|
|
@ -44,6 +44,8 @@ libraries and such might not want.
|
||||||
- [... in `main()`](#-in-main)
|
- [... in `main()`](#-in-main)
|
||||||
- [... diagnostic code URLs](#-diagnostic-code-urls)
|
- [... diagnostic code URLs](#-diagnostic-code-urls)
|
||||||
- [... snippets](#-snippets)
|
- [... snippets](#-snippets)
|
||||||
|
- [... help text](#-help-text)
|
||||||
|
- [... severity level](#-severity-level)
|
||||||
- [... multiple related errors](#-multiple-related-errors)
|
- [... multiple related errors](#-multiple-related-errors)
|
||||||
- [... delayed source code](#-delayed-source-code)
|
- [... delayed source code](#-delayed-source-code)
|
||||||
- [... handler options](#-handler-options)
|
- [... handler options](#-handler-options)
|
||||||
|
|
|
||||||
19
src/lib.rs
19
src/lib.rs
|
|
@ -43,6 +43,8 @@
|
||||||
//! - [... in `main()`](#-in-main)
|
//! - [... in `main()`](#-in-main)
|
||||||
//! - [... diagnostic code URLs](#-diagnostic-code-urls)
|
//! - [... diagnostic code URLs](#-diagnostic-code-urls)
|
||||||
//! - [... snippets](#-snippets)
|
//! - [... snippets](#-snippets)
|
||||||
|
//! - [... help text](#-help-text)
|
||||||
|
//! - [... severity level](#-severity-level)
|
||||||
//! - [... multiple related errors](#-multiple-related-errors)
|
//! - [... multiple related errors](#-multiple-related-errors)
|
||||||
//! - [... delayed source code](#-delayed-source-code)
|
//! - [... delayed source code](#-delayed-source-code)
|
||||||
//! - [... handler options](#-handler-options)
|
//! - [... handler options](#-handler-options)
|
||||||
|
|
@ -424,7 +426,7 @@
|
||||||
//! }
|
//! }
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
//! #### ... help text
|
//! ### ... help text
|
||||||
//! `miette` provides two facilities for supplying help text for your errors:
|
//! `miette` provides two facilities for supplying help text for your errors:
|
||||||
//!
|
//!
|
||||||
//! The first is the `#[help()]` format attribute that applies to structs or
|
//! The first is the `#[help()]` format attribute that applies to structs or
|
||||||
|
|
@ -460,6 +462,19 @@
|
||||||
//! };
|
//! };
|
||||||
//! ```
|
//! ```
|
||||||
//!
|
//!
|
||||||
|
//! ### ... severity level
|
||||||
|
//! `miette` provides a way to set the severity level of a diagnostic.
|
||||||
|
//!
|
||||||
|
//! ```rust
|
||||||
|
//! use miette::Diagnostic;
|
||||||
|
//! use thiserror::Error;
|
||||||
|
//!
|
||||||
|
//! #[derive(Debug, Diagnostic, Error)]
|
||||||
|
//! #[error("welp")]
|
||||||
|
//! #[diagnostic(severity(Warning))]
|
||||||
|
//! struct Foo;
|
||||||
|
//! ```
|
||||||
|
//!
|
||||||
//! ### ... multiple related errors
|
//! ### ... multiple related errors
|
||||||
//!
|
//!
|
||||||
//! `miette` supports collecting multiple errors into a single diagnostic, and
|
//! `miette` supports collecting multiple errors into a single diagnostic, and
|
||||||
|
|
@ -636,7 +651,7 @@
|
||||||
//!
|
//!
|
||||||
//! let source = "2 + 2 * 2 = 8".to_string();
|
//! let source = "2 + 2 * 2 = 8".to_string();
|
||||||
//! let report = miette!(
|
//! let report = miette!(
|
||||||
//! labels = vec[
|
//! labels = vec![
|
||||||
//! LabeledSpan::at(12..13, "this should be 6"),
|
//! LabeledSpan::at(12..13, "this should be 6"),
|
||||||
//! ],
|
//! ],
|
||||||
//! help = "'*' has greater precedence than '+'",
|
//! help = "'*' has greater precedence than '+'",
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue