use core::{error::Error, fmt, ptr};
use crate::Report;
#[repr(transparent)]
pub(crate) struct ReportError<C: ?Sized>(Report<C>);
impl<C: ?Sized> ReportError<C> {
pub(crate) const fn new(report: Report<C>) -> Self {
Self(report)
}
pub(crate) const fn from_ref(report: &Report<C>) -> &Self {
unsafe { &*ptr::from_ref(report).cast() }
}
}
impl<C: ?Sized> fmt::Debug for ReportError<C> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Debug::fmt(&self.0, f)
}
}
impl<C: ?Sized> fmt::Display for ReportError<C> {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
fmt::Display::fmt(&self.0, f)
}
}
impl<C: ?Sized> Error for ReportError<C> {}