diff --git a/src/assign.rs b/src/assign.rs index 2b30439..cc04375 100644 --- a/src/assign.rs +++ b/src/assign.rs @@ -37,8 +37,8 @@ //! use crate::{ + diagnostic::{impl_diagnostic_url, IntoDiagnostic, Label}, index::{OutOfBoundsError, ParseIndexError}, - report::{impl_diagnostic_url, Enrich, Label}, Pointer, }; use alloc::borrow::Cow; @@ -228,7 +228,7 @@ impl fmt::Display for Error { } } -impl<'s> Enrich<'s> for Error { +impl<'s> IntoDiagnostic<'s> for Error { type Subject = Cow<'s, Pointer>; fn url() -> &'static str { diff --git a/src/report.rs b/src/diagnostic.rs similarity index 70% rename from src/report.rs rename to src/diagnostic.rs index 1f628c8..1982039 100644 --- a/src/report.rs +++ b/src/diagnostic.rs @@ -2,14 +2,14 @@ use core::fmt; -/// Implemented by errors which can be converted into a [`Report`]. -pub trait Enrich<'s>: Sized + private::Sealed { +/// Implemented by errors which can be converted into a [`Diagnostic`]. +pub trait IntoDiagnostic<'s>: Sized + private::Sealed { /// The value which caused the error. type Subject; /// Enrich the error with its subject. - fn enrich(self, subject: impl Into) -> Enriched<'s, Self> { - Enriched::new(self, subject) + fn enrich(self, subject: impl Into) -> Diagnostic<'s, Self> { + Diagnostic::new(self, subject) } /// The docs.rs URL for this error @@ -44,12 +44,12 @@ impl From