pub struct RawDiagnostic<FileId> {
    pub severity: Severity,
    pub code: Option<String>,
    pub message: String,
    pub labels: Vec<Label<FileId>, Global>,
    pub notes: Vec<String, Global>,
}
Expand description

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

The position of a Diagnostic is considered to be the position of the Label that has the earliest starting position and has the highest style which appears in all the labels of the diagnostic.

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>, Global>

Source labels that describe the cause of the diagnostic. The order of the labels inside the vector does not have any meaning. The labels are always arranged in the order they appear in the source code.

notes: Vec<String, Global>

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

Implementations

Create a new diagnostic.

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

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

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

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

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

Set the error code of the diagnostic.

Set the message of the diagnostic.

Add some labels to the diagnostic.

Add some notes to the diagnostic.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Deserialize this value from the given Serde deserializer. Read more

Converts to this type from the input type.

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

🔬 This is a nightly-only experimental API. (toowned_clone_into)

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.