Struct proc_macro2_diagnostics::Diagnostic
source · 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) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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
) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn spanned_child<S, T>( self, spans: S, level: Level, message: T ) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn span_error<S, T>(self, spans: S, message: T) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn span_warning<S, T>(self, spans: S, message: T) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn span_note<S, T>(self, spans: S, message: T) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
pub fn span_help<S, T>(self, spans: S, message: T) -> Diagnosticwhere S: MultiSpan, T: Into<String>,
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