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.