pub struct Diagnostic { /* private fields */ }
Expand description
A structure representing a diagnostic message and associated children messages.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic
Creates a new diagnostic with the given level
and message
.
Sourcepub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic
pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnostic
Creates a new diagnostic with the given level
and message
pointing
to the given set of spans
.
Sourcepub fn spanned_child<S, T>(
self,
spans: S,
level: Level,
message: T,
) -> Diagnostic
pub fn spanned_child<S, T>( self, spans: S, level: Level, message: T, ) -> Diagnostic
Adds a new child diagnostic message to self
with the level
and the
given spans
and message
.
Sourcepub fn child<T: Into<String>>(self, level: Level, message: T) -> Diagnostic
pub fn child<T: Into<String>>(self, level: Level, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with level
and the given
message
.
Sourcepub fn span_error<S, T>(self, spans: S, message: T) -> Diagnostic
pub fn span_error<S, T>(self, spans: S, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given spans
and
message
.
Sourcepub fn error<T: Into<String>>(self, message: T) -> Diagnostic
pub fn error<T: Into<String>>(self, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given message
.
Sourcepub fn span_warning<S, T>(self, spans: S, message: T) -> Diagnostic
pub fn span_warning<S, T>(self, spans: S, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given spans
and
message
.
Sourcepub fn warning<T: Into<String>>(self, message: T) -> Diagnostic
pub fn warning<T: Into<String>>(self, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given message
.
Sourcepub fn span_note<S, T>(self, spans: S, message: T) -> Diagnostic
pub fn span_note<S, T>(self, spans: S, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given spans
and
message
.
Sourcepub fn note<T: Into<String>>(self, message: T) -> Diagnostic
pub fn note<T: Into<String>>(self, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given message
.
Sourcepub fn span_help<S, T>(self, spans: S, message: T) -> Diagnostic
pub fn span_help<S, T>(self, spans: S, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given spans
and
message
.
Sourcepub fn help<T: Into<String>>(self, message: T) -> Diagnostic
pub fn help<T: Into<String>>(self, message: T) -> Diagnostic
Adds a new child diagnostic message to self
with the level
identified by this method’s name with the given message
.
Sourcepub fn children(&self) -> impl Iterator<Item = &Diagnostic>
pub fn children(&self) -> impl Iterator<Item = &Diagnostic>
Return the children diagnostics of self
.
Sourcepub fn emit_as_item_tokens(self) -> TokenStream
pub fn emit_as_item_tokens(self) -> TokenStream
Emit tokens, suitable for item contexts, to generate a comple-time
diagnostic corresponding to self
. On nightly, this directly emits the
error and returns an empty token stream.
Sourcepub fn emit_as_item_tokens_or(self, default: TokenStream) -> TokenStream
pub fn emit_as_item_tokens_or(self, default: TokenStream) -> TokenStream
Emit tokens, suitable for item contexts, to generate a comple-time
diagnostic corresponding to self
. On nightly, this directly emits the
error and returns default
.
Sourcepub fn emit_as_expr_tokens(self) -> TokenStream
pub fn emit_as_expr_tokens(self) -> TokenStream
Emit tokens, suitable for expression contexts, to generate a comple-time
diagnostic corresponding to self
. On nightly, this directly emits the
error and returns a ()
token stream.
Sourcepub fn emit_as_expr_tokens_or(self, default: TokenStream) -> TokenStream
pub fn emit_as_expr_tokens_or(self, default: TokenStream) -> TokenStream
Emit tokens, suitable for expressioon contexts, to generate a
comple-time diagnostic corresponding to self
. On nightly, this
directly emits the error and returns default
.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read more