Struct proc_macro::Diagnostic

source ·
pub struct Diagnostic { /* private fields */ }
🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)
Expand description

表示诊断消息和关联的子消息的结构体。

Implementations§

source§

impl Diagnostic

source

pub fn new<T: Into<String>>(level: Level, message: T) -> Diagnostic

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

使用给定的 levelmessage 创建新的诊断。

source

pub 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)

使用给定的 levelmessage 指向给定的 spans 集创建新的诊断。

source

pub 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)

Adds a new child diagnostics message to self with the Level::Error level, and the given spans and message.

source

pub fn error<T: Into<String>>(self, message: T) -> Diagnostic

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

Adds a new child diagnostic message to self with the Level::Error level, and the given message.

source

pub 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)

Adds a new child diagnostics message to self with the Level::Warning level, and the given spans and message.

source

pub fn warning<T: Into<String>>(self, message: T) -> Diagnostic

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

Adds a new child diagnostic message to self with the Level::Warning level, and the given message.

source

pub 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)

Adds a new child diagnostics message to self with the Level::Note level, and the given spans and message.

source

pub fn note<T: Into<String>>(self, message: T) -> Diagnostic

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

Adds a new child diagnostic message to self with the Level::Note level, and the given message.

source

pub 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)

Adds a new child diagnostics message to self with the Level::Help level, and the given spans and message.

source

pub fn help<T: Into<String>>(self, message: T) -> Diagnostic

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

Adds a new child diagnostic message to self with the Level::Help level, and the given message.

source

pub fn level(&self) -> Level

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

返回 self 的诊断 level

source

pub fn set_level(&mut self, level: Level)

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

self 中的级别设置为 level

source

pub fn message(&self) -> &str

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

self 返回消息。

source

pub fn set_message<T: Into<String>>(&mut self, message: T)

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

self 中的消息设置为 message

source

pub fn spans(&self) -> &[Span]

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

返回 self 中的 Span

source

pub fn set_spans<S: MultiSpan>(&mut self, spans: S)

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

self 中的 Span 设置为 spans

source

pub fn children(&self) -> Children<'_>

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

返回 self 子诊断的迭代器。

source

pub fn emit(self)

🔬This is a nightly-only experimental API. (proc_macro_diagnostic #54140)

发出诊断信息。

Trait Implementations§

source§

impl Clone for Diagnostic

source§

fn clone(&self) -> Diagnostic

返回值的副本。 Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

source 执行复制分配。 Read more
source§

impl Debug for Diagnostic

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

使用给定的格式化程序格式化该值。 Read more

Auto Trait Implementations§

Blanket Implementations§

source§

impl<T> Any for Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

获取 selfTypeIdRead more
source§

impl<T> Borrow<T> for Twhere T: ?Sized,

source§

fn borrow(&self) -> &T

从拥有的值中一成不变地借用。 Read more
source§

impl<T> BorrowMut<T> for Twhere T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

从拥有的值中借用。 Read more
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

返回未更改的参数。

source§

impl<T, U> Into<U> for Twhere U: From<T>,

source§

fn into(self) -> U

调用 U::from(self)

也就是说,这种转换是 From<T> for U 实现选择执行的任何操作。

source§

impl<T> ToOwned for Twhere T: Clone,

§

type Owned = T

获得所有权后的结果类型。
source§

fn to_owned(&self) -> T

从借用的数据创建拥有的数据,通常是通过克隆。 Read more
source§

fn clone_into(&self, target: &mut T)

使用借来的数据来替换拥有的数据,通常是通过克隆。 Read more
source§

impl<T, U> TryFrom<U> for Twhere U: Into<T>,

§

type Error = Infallible

发生转换错误时返回的类型。
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

执行转换。
source§

impl<T, U> TryInto<U> for Twhere U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

发生转换错误时返回的类型。
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

执行转换。