pub struct Diagnostic { /* private fields */ }Expand description
A structured diagnostic data value.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub const fn new(level: DiagnosticLevel, message: DiagnosticMessage) -> Self
pub const fn new(level: DiagnosticLevel, message: DiagnosticMessage) -> Self
Creates a diagnostic with a level and message.
Sourcepub fn with_code(self, code: DiagnosticCode) -> Self
pub fn with_code(self, code: DiagnosticCode) -> Self
Returns a diagnostic with the provided code attached.
Sourcepub fn with_label(self, label: DiagnosticLabel) -> Self
pub fn with_label(self, label: DiagnosticLabel) -> Self
Returns a diagnostic with the provided label appended.
Sourcepub fn with_note(self, note: DiagnosticNote) -> Self
pub fn with_note(self, note: DiagnosticNote) -> Self
Returns a diagnostic with the provided note appended.
Sourcepub fn add_note(&mut self, note: DiagnosticNote)
pub fn add_note(&mut self, note: DiagnosticNote)
Appends a note.
Sourcepub const fn code(&self) -> Option<&DiagnosticCode>
pub const fn code(&self) -> Option<&DiagnosticCode>
Returns the optional diagnostic code.
Sourcepub const fn level(&self) -> DiagnosticLevel
pub const fn level(&self) -> DiagnosticLevel
Returns the diagnostic level.
Sourcepub const fn message(&self) -> &DiagnosticMessage
pub const fn message(&self) -> &DiagnosticMessage
Returns the diagnostic message.
Sourcepub fn notes(&self) -> &[DiagnosticNote]
pub fn notes(&self) -> &[DiagnosticNote]
Returns the diagnostic notes.
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 · 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
Source§impl FromIterator<Diagnostic> for DiagnosticReport
impl FromIterator<Diagnostic> for DiagnosticReport
Source§fn from_iter<T: IntoIterator<Item = Diagnostic>>(diagnostics: T) -> Self
fn from_iter<T: IntoIterator<Item = Diagnostic>>(diagnostics: T) -> Self
Creates a value from an iterator. Read more
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
impl Eq 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