pub struct DiagnosticData {
pub message: String,
pub spans: Vec<Span>,
pub annotations: Vec<Annotation>,
pub notes: Vec<(AnnotationKind, String)>,
pub fixes: Vec<Fix>,
}
Expand description
The data used to construct a diagnostic.
Fields§
§message: String
The main diagnostic message.
spans: Vec<Span>
Diagnostic’s spans
annotations: Vec<Annotation>
Annotations provided along the diagnostics
notes: Vec<(AnnotationKind, String)>
Spanless notes provided along the diagnostic
fixes: Vec<Fix>
Suggested fixes for the diagnostic
Implementations§
Source§impl DiagnosticData
impl DiagnosticData
Sourcepub fn new<S: ToString + ?Sized>(message: &S) -> Self
pub fn new<S: ToString + ?Sized>(message: &S) -> Self
Creates an empty diagnostic with just a message.
Sourcepub fn add_note(self, kind: AnnotationKind, message: String) -> Self
pub fn add_note(self, kind: AnnotationKind, message: String) -> Self
Add a note (spanless annotation) to the diagnostic.
Sourcepub fn add_annotation<S: ToString + ?Sized>(
self,
at: Span,
kind: AnnotationKind,
message: &S,
) -> Self
pub fn add_annotation<S: ToString + ?Sized>( self, at: Span, kind: AnnotationKind, message: &S, ) -> Self
Add an annotation (message with a span).
Sourcepub fn add_annotation_opt_msg<S: ToString + ?Sized>(
self,
at: Span,
kind: AnnotationKind,
message: Option<&S>,
) -> Self
pub fn add_annotation_opt_msg<S: ToString + ?Sized>( self, at: Span, kind: AnnotationKind, message: Option<&S>, ) -> Self
Add an annotation if message
is Some
Sourcepub fn add_annotation_opt_span<S: ToString + ?Sized>(
self,
at: Option<Span>,
kind: AnnotationKind,
message: &S,
) -> Self
pub fn add_annotation_opt_span<S: ToString + ?Sized>( self, at: Option<Span>, kind: AnnotationKind, message: &S, ) -> Self
Add an annotation if span
is Some
Auto Trait Implementations§
impl Freeze for DiagnosticData
impl RefUnwindSafe for DiagnosticData
impl Send for DiagnosticData
impl Sync for DiagnosticData
impl Unpin for DiagnosticData
impl UnwindSafe for DiagnosticData
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
Source§impl<T> Convert for T
impl<T> Convert for T
Source§fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
fn convert<U>(self, context: &CompileContext) -> Expr<U>where
U: ConvertFrom<T>,
Convert
self
into a specific type. Read moreSource§fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
fn can_convert<U>(&self) -> boolwhere
U: ConvertFrom<T>,
Check if
self
can be converted into a specific type. Read more