pub struct Diagnostic { /* private fields */ }
Expand description
Represents a single diagnostic message
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new(level: Level, message: String) -> Self
pub fn new(level: Level, message: String) -> Self
Create a new diagnostic message that points to Span::call_site()
Sourcepub fn spanned(span: Span, level: Level, message: String) -> Self
pub fn spanned(span: Span, level: Level, message: String) -> Self
Create a new diagnostic message that points to the span
Sourcepub fn span_error(self, span: Span, msg: String) -> Self
pub fn span_error(self, span: Span, msg: String) -> Self
Add another error message to self such that it will be emitted right after the main message.
Sourcepub fn span_help(self, span: Span, msg: String) -> Self
pub fn span_help(self, span: Span, msg: String) -> Self
Attach a “help” note to your main message, the note will have it’s own span on nightly.
§Span
The span is ignored on stable, the note effectively inherits its parent’s (main message) span
Sourcepub fn span_note(self, span: Span, msg: String) -> Self
pub fn span_note(self, span: Span, msg: String) -> Self
Attach a note to your main message, the note will have it’s own span on nightly.
§Span
The span is ignored on stable, the note effectively inherits its parent’s (main message) span
Trait Implementations§
Source§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl DiagnosticExt for Diagnostic
impl DiagnosticExt for Diagnostic
Source§fn spanned_range(span_range: SpanRange, level: Level, message: String) -> Self
fn spanned_range(span_range: SpanRange, level: Level, message: String) -> Self
Create a new diagnostic message that points to the
span_range
. Read moreSource§fn span_range_error(self, span_range: SpanRange, msg: String) -> Self
fn span_range_error(self, span_range: SpanRange, msg: String) -> Self
Add another error message to self such that it will be emitted right after
the main message. Read more
Source§impl From<Error> for Diagnostic
impl From<Error> for Diagnostic
Source§impl ToTokens for Diagnostic
impl ToTokens for Diagnostic
Source§fn to_tokens(&self, ts: &mut TokenStream)
fn to_tokens(&self, ts: &mut TokenStream)
Source§fn to_token_stream(&self) -> TokenStream
fn to_token_stream(&self) -> TokenStream
Source§fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
fn into_token_stream(self) -> TokenStreamwhere
Self: Sized,
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl !Send for Diagnostic
impl !Sync for Diagnostic
impl Unpin for Diagnostic
impl UnwindSafe for Diagnostic
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> Spanned for Twhere
T: Spanned + ?Sized,
impl<T> Spanned for Twhere
T: Spanned + ?Sized,
Source§fn span(&self) -> Span
fn span(&self) -> Span
Returns a
Span
covering the complete contents of this syntax tree
node, or Span::call_site()
if this node is empty.