mirror of https://github.com/zkat/miette.git
Clarified semantic similarity with anyhow/eyre types/macros.
This commit is contained in:
parent
ccc97310fa
commit
e49794fc01
|
|
@ -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.
|
||||
|
||||
|
|
|
|||
|
|
@ -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 $(,)?) => {
|
||||
|
|
|
|||
|
|
@ -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<Box<ErrorImpl<()>>>,
|
||||
|
|
@ -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<T, E = Report> = core::result::Result<T, E>;
|
||||
|
||||
/// Provides the `wrap_err` method for `Result`.
|
||||
|
|
|
|||
Loading…
Reference in New Issue