[][src]Struct codespan_reporting::diagnostic::Diagnostic

pub struct Diagnostic<FileId> {
    pub severity: Severity,
    pub code: Option<String>,
    pub message: String,
    pub labels: Vec<Label<FileId>>,
    pub notes: Vec<String>,
}

Represents a diagnostic message that can provide information like errors and warnings to the user.

Fields

severity: Severity

The overall severity of the diagnostic

code: Option<String>

An optional code that identifies this diagnostic.

message: String

The main message associated with this diagnostic.

These should not include line breaks, and in order support the 'short' diagnostic display mod, the message should be specific enough to make sense on its own, without additional context provided by labels and notes.

labels: Vec<Label<FileId>>

Source labels that describe the cause of the diagnostic.

notes: Vec<String>

Notes that are associated with the primary cause of the diagnostic. These can include line breaks for improved formatting.

Implementations

impl<FileId> Diagnostic<FileId>[src]

pub fn new(severity: Severity) -> Diagnostic<FileId>[src]

Create a new diagnostic.

pub fn bug() -> Diagnostic<FileId>[src]

Create a new diagnostic with a severity of Severity::Bug.

pub fn error() -> Diagnostic<FileId>[src]

Create a new diagnostic with a severity of Severity::Error.

pub fn warning() -> Diagnostic<FileId>[src]

Create a new diagnostic with a severity of Severity::Warning.

pub fn note() -> Diagnostic<FileId>[src]

Create a new diagnostic with a severity of Severity::Note.

pub fn help() -> Diagnostic<FileId>[src]

Create a new diagnostic with a severity of Severity::Help.

pub fn with_code(self, code: impl Into<String>) -> Diagnostic<FileId>[src]

Add an error code to the diagnostic.

pub fn with_message(self, message: impl Into<String>) -> Diagnostic<FileId>[src]

Add a message to the diagnostic.

pub fn with_labels(self, labels: Vec<Label<FileId>>) -> Diagnostic<FileId>[src]

Add some labels to the diagnostic.

pub fn with_notes(self, notes: Vec<String>) -> Diagnostic<FileId>[src]

Add some notes to the diagnostic.

Trait Implementations

impl<FileId: Clone> Clone for Diagnostic<FileId>[src]

impl<FileId: Debug> Debug for Diagnostic<FileId>[src]

Auto Trait Implementations

impl<FileId> RefUnwindSafe for Diagnostic<FileId> where
    FileId: RefUnwindSafe

impl<FileId> Send for Diagnostic<FileId> where
    FileId: Send

impl<FileId> Sync for Diagnostic<FileId> where
    FileId: Sync

impl<FileId> Unpin for Diagnostic<FileId> where
    FileId: Unpin

impl<FileId> UnwindSafe for Diagnostic<FileId> where
    FileId: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.