#[non_exhaustive]pub struct Diagnostic {
pub range: TextRange,
pub message: String,
pub severity: Severity,
pub code: DiagnosticCode,
}Expand description
A single structured diagnostic produced during error-tolerant parsing.
Carries a precise source byte TextRange (TR-006), a human-readable
message, a Severity, and a stable DiagnosticCode (TR-013). One
Diagnostic is emitted per recovery point; diagnostics never change the
tree’s byte coverage (INV-3).
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.range: TextRangeByte range the diagnostic refers to (a sub-range of [0, source_len)).
message: StringHuman-readable description of the recovery.
severity: SeverityFixed severity classification.
code: DiagnosticCodeStable namespaced RON-Pxxxx code.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(
code: DiagnosticCode,
range: TextRange,
message: impl Into<String>,
) -> Self
pub fn new( code: DiagnosticCode, range: TextRange, message: impl Into<String>, ) -> Self
Construct a diagnostic with the DiagnosticCode’s default severity.
Sourcepub fn code(&self) -> DiagnosticCode
pub fn code(&self) -> DiagnosticCode
This diagnostic’s stable DiagnosticCode.
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
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