Struct rtlola_frontend::RawDiagnostic
[−]pub struct RawDiagnostic<FileId> {
pub severity: Severity,
pub code: Option<String>,
pub message: String,
pub labels: Vec<Label<FileId>, Global>,
pub notes: Vec<String, Global>,
}
Expand description
Represents a diagnostic message that can provide information like errors and warnings to the user.
The position of a Diagnostic is considered to be the position of the [Label
] that has the earliest starting position and has the highest style which appears in all the labels of the diagnostic.
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>, Global>
Source labels that describe the cause of the diagnostic. The order of the labels inside the vector does not have any meaning. The labels are always arranged in the order they appear in the source code.
notes: Vec<String, Global>
Notes that are associated with the primary cause of the diagnostic. These can include line breaks for improved formatting.
Implementations
impl<FileId> Diagnostic<FileId>
impl<FileId> Diagnostic<FileId>
pub fn new(severity: Severity) -> Diagnostic<FileId>
pub fn new(severity: Severity) -> Diagnostic<FileId>
Create a new diagnostic.
pub fn bug() -> Diagnostic<FileId>
pub fn bug() -> Diagnostic<FileId>
Create a new diagnostic with a severity of Severity::Bug
.
pub fn error() -> Diagnostic<FileId>
pub fn error() -> Diagnostic<FileId>
Create a new diagnostic with a severity of Severity::Error
.
pub fn warning() -> Diagnostic<FileId>
pub fn warning() -> Diagnostic<FileId>
Create a new diagnostic with a severity of Severity::Warning
.
pub fn note() -> Diagnostic<FileId>
pub fn note() -> Diagnostic<FileId>
Create a new diagnostic with a severity of Severity::Note
.
pub fn help() -> Diagnostic<FileId>
pub fn help() -> Diagnostic<FileId>
Create a new diagnostic with a severity of Severity::Help
.
pub fn with_code(self, code: impl Into<String>) -> Diagnostic<FileId>
pub fn with_code(self, code: impl Into<String>) -> Diagnostic<FileId>
Set the error code of the diagnostic.
pub fn with_message(self, message: impl Into<String>) -> Diagnostic<FileId>
pub fn with_message(self, message: impl Into<String>) -> Diagnostic<FileId>
Set the message of the diagnostic.
pub fn with_labels(
self,
labels: Vec<Label<FileId>, Global>
) -> Diagnostic<FileId>
pub fn with_labels(
self,
labels: Vec<Label<FileId>, Global>
) -> Diagnostic<FileId>
Add some labels to the diagnostic.
pub fn with_notes(self, notes: Vec<String, Global>) -> Diagnostic<FileId>
pub fn with_notes(self, notes: Vec<String, Global>) -> Diagnostic<FileId>
Add some notes to the diagnostic.
Trait Implementations
impl<FileId> Clone for Diagnostic<FileId> where
FileId: Clone,
impl<FileId> Clone for Diagnostic<FileId> where
FileId: Clone,
fn clone(&self) -> Diagnostic<FileId>
fn clone(&self) -> Diagnostic<FileId>
Returns a copy of the value. Read more
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from source
. Read more
impl<FileId> Debug for Diagnostic<FileId> where
FileId: Debug,
impl<FileId> Debug for Diagnostic<FileId> where
FileId: Debug,
impl<'de, FileId> Deserialize<'de> for Diagnostic<FileId> where
FileId: Deserialize<'de>,
impl<'de, FileId> Deserialize<'de> for Diagnostic<FileId> where
FileId: Deserialize<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Diagnostic<FileId>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<Diagnostic<FileId>, <__D as Deserializer<'de>>::Error> where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
sourceimpl From<Diagnostic> for Diagnostic<()>
impl From<Diagnostic> for Diagnostic<()>
sourcefn from(diag: Diagnostic) -> Diagnostic<()>
fn from(diag: Diagnostic) -> Diagnostic<()>
Converts to this type from the input type.
impl<FileId> PartialEq<Diagnostic<FileId>> for Diagnostic<FileId> where
FileId: PartialEq<FileId>,
impl<FileId> PartialEq<Diagnostic<FileId>> for Diagnostic<FileId> where
FileId: PartialEq<FileId>,
fn eq(&self, other: &Diagnostic<FileId>) -> bool
fn eq(&self, other: &Diagnostic<FileId>) -> bool
This method tests for self
and other
values to be equal, and is used
by ==
. Read more
fn ne(&self, other: &Diagnostic<FileId>) -> bool
fn ne(&self, other: &Diagnostic<FileId>) -> bool
This method tests for !=
.
impl<FileId> Serialize for Diagnostic<FileId> where
FileId: Serialize,
impl<FileId> Serialize for Diagnostic<FileId> where
FileId: Serialize,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error> where
__S: Serializer,
Serialize this value into the given Serde serializer. Read more
impl<FileId> Eq for Diagnostic<FileId> where
FileId: Eq,
impl<FileId> StructuralEq for Diagnostic<FileId>
impl<FileId> StructuralPartialEq for Diagnostic<FileId>
Auto Trait Implementations
impl<FileId> RefUnwindSafe for Diagnostic<FileId> where
FileId: RefUnwindSafe,
impl<FileId> Send for Diagnostic<FileId> where
FileId: Send,
impl<FileId> Sync for Diagnostic<FileId> where
FileId: Sync,
impl<FileId> Unpin for Diagnostic<FileId> where
FileId: Unpin,
impl<FileId> UnwindSafe for Diagnostic<FileId> where
FileId: UnwindSafe,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
impl<Q, K> Equivalent<K> for Q where
Q: Eq + ?Sized,
K: Borrow<Q> + ?Sized,
sourcefn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to key
and return true
if they are equal.
sourceimpl<T> ToOwned for T where
T: Clone,
impl<T> ToOwned for T where
T: Clone,
type Owned = T
type Owned = T
The resulting type after obtaining ownership.
sourcefn clone_into(&self, target: &mut T)
fn clone_into(&self, target: &mut T)
toowned_clone_into
)Uses borrowed data to replace owned data, usually by cloning. Read more