pub struct Diagnostic { /* private fields */ }Expand description
A structured diagnostic with optional source context and suggestions.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(
code: DiagnosticCode,
title: impl Into<String>,
message: impl Into<String>,
) -> Self
pub fn new( code: DiagnosticCode, title: impl Into<String>, message: impl Into<String>, ) -> Self
Creates a diagnostic with a code, short title, and detailed message.
Sourcepub fn with_subject(self, subject: impl Into<String>) -> Self
pub fn with_subject(self, subject: impl Into<String>) -> Self
Adds the subject associated with this diagnostic.
Sourcepub fn with_location(self, location: SourceLocation) -> Self
pub fn with_location(self, location: SourceLocation) -> Self
Adds the source location associated with this diagnostic.
Sourcepub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
pub fn with_suggestion(self, suggestion: impl Into<String>) -> Self
Adds a remediation suggestion to this diagnostic.
Sourcepub const fn code(&self) -> DiagnosticCode
pub const fn code(&self) -> DiagnosticCode
Returns this diagnostic’s stable code.
Sourcepub fn subject(&self) -> Option<&str>
pub fn subject(&self) -> Option<&str>
Returns the subject associated with this diagnostic, when present.
Sourcepub const fn location(&self) -> Option<SourceLocation>
pub const fn location(&self) -> Option<SourceLocation>
Returns the source location associated with this diagnostic, when present.
Sourcepub fn suggestions(&self) -> &[String]
pub fn suggestions(&self) -> &[String]
Returns remediation suggestions in insertion order.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl Display for Diagnostic
impl Display for Diagnostic
impl Eq for Diagnostic
Source§impl Hash for Diagnostic
impl Hash for Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Forget for Diagnostic
impl Freeze for Diagnostic
impl Move 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§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.