From e49794fc0171d8c365d077e32fb00631f2f88371 Mon Sep 17 00:00:00 2001 From: Moritz Moeller Date: Fri, 25 Feb 2022 01:58:30 +0100 Subject: [PATCH] Clarified semantic similarity with anyhow/eyre types/macros. --- README.md | 5 +++-- src/eyreish/macros.rs | 4 ++++ src/eyreish/mod.rs | 9 +++++++++ 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index e665e17..ab1c989 100644 --- a/README.md +++ b/README.md @@ -53,8 +53,9 @@ and such might not want. - Unique error codes on every [`Diagnostic`]. - Custom links to get more details on error codes. - Super handy derive macro for defining diagnostic metadata. -- [`anyhow`](https://docs.rs/anyhow)/[`eyre`](https://docs.rs/eyre) error - wrapper type, [`Report`], which can be returned from `main()`. +- Replacements for [`anyhow`](https://docs.rs/anyhow)/[`eyre`](https://docs.rs/eyre) + types [`Result`], [`Report`] and the [`miette!`] macro for the `anyhow!`/`eyre!` + macros. - Generic support for arbitrary [`SourceCode`]s for snippet data, with default support for `String`s included. diff --git a/src/eyreish/macros.rs b/src/eyreish/macros.rs index ff8c1fe..0bc5520 100644 --- a/src/eyreish/macros.rs +++ b/src/eyreish/macros.rs @@ -146,6 +146,10 @@ macro_rules! ensure { /// # Ok(()) /// } /// ``` +/// +/// ## `anyhow`/`eyre` Users +/// +/// You can just replace `use`s of the `anyhow!`/`eyre!` macros with `miette!`. #[macro_export] macro_rules! miette { ($msg:literal $(,)?) => { diff --git a/src/eyreish/mod.rs b/src/eyreish/mod.rs index d13891d..3559f8b 100644 --- a/src/eyreish/mod.rs +++ b/src/eyreish/mod.rs @@ -44,6 +44,10 @@ mod wrapper; /** Core Diagnostic wrapper type. + +## `eyre` Users + +You can just replace `use`s of `eyre::Report` with `miette::Report`. */ pub struct Report { inner: ManuallyDrop>>, @@ -241,6 +245,11 @@ pub trait ReportHandler: core::any::Any + Send + Sync { /// Ok(()) /// } /// ``` +/// +/// ## `anyhow`/`eyre` Users +/// +/// You can just replace `use`s of `anyhow::Result`/`eyre::Result` with +/// `miette::Result`. pub type Result = core::result::Result; /// Provides the `wrap_err` method for `Result`.