[−][src]Struct codespan_reporting::diagnostic::Diagnostic
Represents a diagnostic message that can provide information like errors and warnings to the user.
Fields
severity: Severity
The overall severity of the diagnostic
code: Option<String>
An optional code that identifies this diagnostic.
message: String
The main message associated with this diagnostic.
These should not include line breaks, and in order support the 'short' diagnostic display mod, the message should be specific enough to make sense on its own, without additional context provided by labels and notes.
labels: Vec<Label<FileId>>
Source labels that describe the cause of the diagnostic.
notes: Vec<String>
Notes that are associated with the primary cause of the diagnostic. These can include line breaks for improved formatting.
Implementations
impl<FileId> Diagnostic<FileId>
[src]
pub fn new(severity: Severity) -> Diagnostic<FileId>
[src]
Create a new diagnostic.
pub fn bug() -> Diagnostic<FileId>
[src]
Create a new diagnostic with a severity of Severity::Bug
.
pub fn error() -> Diagnostic<FileId>
[src]
Create a new diagnostic with a severity of Severity::Error
.
pub fn warning() -> Diagnostic<FileId>
[src]
Create a new diagnostic with a severity of Severity::Warning
.
pub fn note() -> Diagnostic<FileId>
[src]
Create a new diagnostic with a severity of Severity::Note
.
pub fn help() -> Diagnostic<FileId>
[src]
Create a new diagnostic with a severity of Severity::Help
.
pub fn with_code(self, code: impl Into<String>) -> Diagnostic<FileId>
[src]
Add an error code to the diagnostic.
pub fn with_message(self, message: impl Into<String>) -> Diagnostic<FileId>
[src]
Add a message to the diagnostic.
pub fn with_labels(self, labels: Vec<Label<FileId>>) -> Diagnostic<FileId>
[src]
Add some labels to the diagnostic.
pub fn with_notes(self, notes: Vec<String>) -> Diagnostic<FileId>
[src]
Add some notes to the diagnostic.
Trait Implementations
impl<FileId: Clone> Clone for Diagnostic<FileId>
[src]
fn clone(&self) -> Diagnostic<FileId>
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<FileId: Debug> Debug for Diagnostic<FileId>
[src]
Auto Trait Implementations
impl<FileId> RefUnwindSafe for Diagnostic<FileId> where
FileId: RefUnwindSafe,
FileId: RefUnwindSafe,
impl<FileId> Send for Diagnostic<FileId> where
FileId: Send,
FileId: Send,
impl<FileId> Sync for Diagnostic<FileId> where
FileId: Sync,
FileId: Sync,
impl<FileId> Unpin for Diagnostic<FileId> where
FileId: Unpin,
FileId: Unpin,
impl<FileId> UnwindSafe for Diagnostic<FileId> where
FileId: UnwindSafe,
FileId: UnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,