[−][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 the message should be specific
enough to make sense when paired only with the location given by the
primary_label
.
primary_label: Label
A label that describes the primary cause of this diagnostic.
notes: Vec<String>
Notes that are associated with the primary cause of the diagnostic. These can include line breaks for improved formatting.
secondary_labels: Vec<Label>
Secondary labels that provide additional context for the diagnostic.
Methods
impl Diagnostic
[src]
pub fn new(
severity: Severity,
message: impl Into<String>,
primary_label: Label
) -> Diagnostic
[src]
severity: Severity,
message: impl Into<String>,
primary_label: Label
) -> Diagnostic
Create a new diagnostic.
pub fn new_bug(message: impl Into<String>, primary_label: Label) -> Diagnostic
[src]
Create a new diagnostic with a severity of Severity::Bug
.
pub fn new_error(message: impl Into<String>, primary_label: Label) -> Diagnostic
[src]
Create a new diagnostic with a severity of Severity::Error
.
pub fn new_warning(
message: impl Into<String>,
primary_label: Label
) -> Diagnostic
[src]
message: impl Into<String>,
primary_label: Label
) -> Diagnostic
Create a new diagnostic with a severity of Severity::Warning
.
pub fn new_note(message: impl Into<String>, primary_label: Label) -> Diagnostic
[src]
Create a new diagnostic with a severity of Severity::Note
.
pub fn new_help(message: impl Into<String>, primary_label: Label) -> Diagnostic
[src]
Create a new diagnostic with a severity of Severity::Help
.
pub fn with_code(self, code: impl Into<String>) -> Diagnostic
[src]
Add an error code to the diagnostic.
pub fn with_notes(self, notes: Vec<String>) -> Diagnostic
[src]
Add some notes to the diagnostic.
pub fn with_secondary_labels(
self,
labels: impl IntoIterator<Item = Label>
) -> Diagnostic
[src]
self,
labels: impl IntoIterator<Item = Label>
) -> Diagnostic
Add some secondary labels to the diagnostic.
Trait Implementations
impl Clone for Diagnostic
[src]
fn clone(&self) -> Diagnostic
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Debug for Diagnostic
[src]
Auto Trait Implementations
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnwindSafe for Diagnostic
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>,