Trait Diagnostic

Source
pub trait Diagnostic: Sized {
    type Subject: Deref;

    // Required methods
    fn url() -> &'static str;
    fn labels(
        &self,
        subject: &Self::Subject,
    ) -> Option<Box<dyn Iterator<Item = Label>>>;

    // Provided method
    fn into_report(self, subject: impl Into<Self::Subject>) -> Report<Self> { ... }
}
Expand description

Implemented by errors which can be converted into a Report.

Required Associated Types§

Source

type Subject: Deref

The value which caused the error.

Required Methods§

Source

fn url() -> &'static str

The docs.rs URL for this error

Source

fn labels( &self, subject: &Self::Subject, ) -> Option<Box<dyn Iterator<Item = Label>>>

Returns the label for the given [Subject] if applicable.

Provided Methods§

Source

fn into_report(self, subject: impl Into<Self::Subject>) -> Report<Self>

Combine the error with its subject to generate a Report.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§