use super::DiagnosticEvent;
pub trait DiagnosticObserver {
type Error;
fn observe(&self, event: DiagnosticEvent) -> Result<(), Self::Error>;
}
#[derive(Clone, Copy, Debug, Default, Eq, PartialEq)]
pub struct NoopDiagnosticObserver;
impl DiagnosticObserver for NoopDiagnosticObserver {
type Error = core::convert::Infallible;
fn observe(&self, _event: DiagnosticEvent) -> Result<(), Self::Error> {
Ok(())
}
}
pub(crate) fn notify<O>(observer: &O, event: DiagnosticEvent)
where
O: DiagnosticObserver + ?Sized,
{
let _ignored = observer.observe(event);
}