pub struct SourceDiagnostic {
pub span: Span,
pub severity: DiagnosticSeverity,
pub message: String,
pub code: Option<String>,
pub related: Vec<(Span, String)>,
}Expand description
A diagnostic message with a source location.
Fields§
§span: SpanSpan of the diagnostic.
severity: DiagnosticSeveritySeverity level.
message: StringThe diagnostic message.
code: Option<String>Optional code (e.g. “E001”).
Optional related spans (e.g. for “note” entries).
Implementations§
Source§impl SourceDiagnostic
impl SourceDiagnostic
Sourcepub fn new(
span: Span,
severity: DiagnosticSeverity,
message: impl Into<String>,
) -> Self
pub fn new( span: Span, severity: DiagnosticSeverity, message: impl Into<String>, ) -> Self
Create a new diagnostic.
Sourcepub fn info(span: Span, message: impl Into<String>) -> Self
pub fn info(span: Span, message: impl Into<String>) -> Self
Create an informational diagnostic.
Add a related location.
Sourcepub fn is_warning(&self) -> bool
pub fn is_warning(&self) -> bool
Whether this is a warning.
Trait Implementations§
Source§impl Clone for SourceDiagnostic
impl Clone for SourceDiagnostic
Source§fn clone(&self) -> SourceDiagnostic
fn clone(&self) -> SourceDiagnostic
Returns a duplicate of the value. Read more
1.0.0 · 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 SourceDiagnostic
impl Debug for SourceDiagnostic
Source§impl PartialEq for SourceDiagnostic
impl PartialEq for SourceDiagnostic
impl StructuralPartialEq for SourceDiagnostic
Auto Trait Implementations§
impl Freeze for SourceDiagnostic
impl RefUnwindSafe for SourceDiagnostic
impl Send for SourceDiagnostic
impl Sync for SourceDiagnostic
impl Unpin for SourceDiagnostic
impl UnsafeUnpin for SourceDiagnostic
impl UnwindSafe for SourceDiagnostic
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