Struct proc_macro::Diagnostic
source · [−]pub struct Diagnostic { /* private fields */ }
proc_macro_diagnostic
#54140)Expand description
A structure representing a diagnostic message and associated children messages.
Implementations
sourceimpl Diagnostic
impl Diagnostic
sourcepub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic
proc_macro_diagnostic
#54140)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>,
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn spanned<S, T>(spans: S, level: Level, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
proc_macro_diagnostic
#54140)Creates a new diagnostic with the given level
and message
pointing to
the given set of spans
.
sourcepub fn span_error<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn span_error<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
proc_macro_diagnostic
#54140)Adds a new child diagnostics message to self
with the Level::Error
level, and the given spans
and message
.
sourcepub fn error<T: Into<String>>(self, message: T) -> Diagnostic
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn error<T: Into<String>>(self, message: T) -> Diagnostic
proc_macro_diagnostic
#54140)Adds a new child diagnostic message to self
with the Level::Error
level, and the given message
.
sourcepub fn span_warning<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn span_warning<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
proc_macro_diagnostic
#54140)Adds a new child diagnostics message to self
with the Level::Warning
level, and the given spans
and message
.
sourcepub fn warning<T: Into<String>>(self, message: T) -> Diagnostic
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn warning<T: Into<String>>(self, message: T) -> Diagnostic
proc_macro_diagnostic
#54140)Adds a new child diagnostic message to self
with the Level::Warning
level, and the given message
.
sourcepub fn span_note<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn span_note<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
proc_macro_diagnostic
#54140)Adds a new child diagnostics message to self
with the Level::Note
level, and the given spans
and message
.
sourcepub fn note<T: Into<String>>(self, message: T) -> Diagnostic
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn note<T: Into<String>>(self, message: T) -> Diagnostic
proc_macro_diagnostic
#54140)Adds a new child diagnostic message to self
with the Level::Note
level, and the given message
.
sourcepub fn span_help<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn span_help<S, T>(self, spans: S, message: T) -> Diagnosticwhere
S: MultiSpan,
T: Into<String>,
proc_macro_diagnostic
#54140)Adds a new child diagnostics message to self
with the Level::Help
level, and the given spans
and message
.
sourcepub fn help<T: Into<String>>(self, message: T) -> Diagnostic
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn help<T: Into<String>>(self, message: T) -> Diagnostic
proc_macro_diagnostic
#54140)Adds a new child diagnostic message to self
with the Level::Help
level, and the given message
.
sourcepub fn level(&self) -> Level
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn level(&self) -> Level
proc_macro_diagnostic
#54140)Returns the diagnostic level
for self
.
sourcepub fn set_level(&mut self, level: Level)
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn set_level(&mut self, level: Level)
proc_macro_diagnostic
#54140)Sets the level in self
to level
.
sourcepub fn message(&self) -> &str
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn message(&self) -> &str
proc_macro_diagnostic
#54140)Returns the message in self
.
sourcepub fn set_message<T: Into<String>>(&mut self, message: T)
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn set_message<T: Into<String>>(&mut self, message: T)
proc_macro_diagnostic
#54140)Sets the message in self
to message
.
sourcepub fn spans(&self) -> &[Span]
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn spans(&self) -> &[Span]
proc_macro_diagnostic
#54140)Returns the Span
s in self
.
sourcepub fn set_spans<S: MultiSpan>(&mut self, spans: S)
🔬This is a nightly-only experimental API. (proc_macro_diagnostic
#54140)
pub fn set_spans<S: MultiSpan>(&mut self, spans: S)
proc_macro_diagnostic
#54140)Sets the Span
s in self
to spans
.
Trait Implementations
sourceimpl Clone for Diagnostic
impl Clone for Diagnostic
sourcefn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 · sourceconst fn clone_from(&mut self, source: &Self)
const fn clone_from(&mut self, source: &Self)
source
. Read more