Struct codespan_derive::Diagnostic [−][src]
pub struct Diagnostic<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: SeverityThe overall severity of the diagnostic
code: Option<String>An optional code that identifies this diagnostic.
message: StringThe 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
impl<FileId> PartialEq<Diagnostic<FileId>> for Diagnostic<FileId> where
FileId: PartialEq<FileId>,
impl<FileId> PartialEq<Diagnostic<FileId>> for Diagnostic<FileId> where
FileId: PartialEq<FileId>,
This method tests for self and other values to be equal, and is used
by ==. Read more
This method tests for !=.
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
Mutably borrows from an owned value. Read more