pub struct Diagnostic {
pub range: (usize, usize),
pub severity: DiagnosticSeverity,
pub code: Option<String>,
pub message: String,
pub related_information: Vec<RelatedInformation>,
pub tags: Vec<DiagnosticTag>,
pub suggestion: Option<String>,
}Expand description
A diagnostic message (internal working type).
This is the rich internal type used by the linting machinery. It has string-based codes for compatibility with the diagnostic pipeline.
Fields§
§range: (usize, usize)Source code range (start, end) where the issue occurs.
severity: DiagnosticSeveritySeverity level of the diagnostic.
code: Option<String>Optional diagnostic code for categorization.
message: StringHuman-readable description of the issue.
Additional context and related information.
Tags for categorizing the diagnostic.
suggestion: Option<String>Optional short suggestion for how to fix the issue.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(
range: (usize, usize),
severity: DiagnosticSeverity,
message: impl Into<String>,
) -> Diagnostic
pub fn new( range: (usize, usize), severity: DiagnosticSeverity, message: impl Into<String>, ) -> Diagnostic
Creates a diagnostic with required fields and sensible defaults.
Sourcepub fn with_code(self, code: impl Into<String>) -> Diagnostic
pub fn with_code(self, code: impl Into<String>) -> Diagnostic
Sets the optional diagnostic code.
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> Diagnostic
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Diagnostic
Sets the optional suggestion text.
Adds related information to this diagnostic.
Sourcepub fn with_tag(self, tag: DiagnosticTag) -> Diagnostic
pub fn with_tag(self, tag: DiagnosticTag) -> Diagnostic
Adds a tag to this diagnostic.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
impl Eq for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§fn eq(&self, other: &Diagnostic) -> bool
fn eq(&self, other: &Diagnostic) -> bool
Tests for
self and other values to be equal, and is used by ==.impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.