[][src]Struct codespan_reporting::diagnostic::Diagnostic

pub struct Diagnostic {
    pub severity: Severity,
    pub code: Option<String>,
    pub message: String,
    pub primary_label: Label,
    pub notes: Vec<String>,
    pub secondary_labels: Vec<Label>,
}

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]

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]

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]

Add some secondary labels to the diagnostic.

Trait Implementations

impl Clone for Diagnostic[src]

impl Debug for Diagnostic[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.