Skip to main content

BuildDiagnostic

Struct BuildDiagnostic 

Source
pub struct BuildDiagnostic {
    pub phase: &'static str,
    pub branch: String,
    pub node: String,
    pub source: String,
    pub line: usize,
    pub function: String,
    pub field: String,
    pub expected: String,
    pub actual: String,
    pub provider: String,
    pub message: String,
}
Expand description

One declaration error before it is rendered for rustc or a terminal. 在输出给 rustc 或终端之前的一条声明错误。

Fields§

§phase: &'static str

Build phase that raised this diagnostic; empty means the phase is not applicable to this diagnostic. 提出该诊断的构建阶段;为空表示该阶段不适用于此诊断。

§branch: String

Graft branch the failure was reported under; empty means not applicable. 报告该失败时所在的 graft 分支;为空表示不适用。

§node: String

Registration face identity rendered as name (kind); empty means not applicable. 渲染为 name (kind) 的注册面身份;为空表示不适用。

§source: String

Declaration source file carrying the failure; empty means not applicable. 携带该失败的声明源文件;为空表示不适用。

§line: usize

1-based line inside source; 0 when the diagnostic has no line. source 内以 1 起始的行号;诊断没有行号时为 0。

§function: String

Logical function or handle the failure is about; empty means not applicable. 失败所针对的逻辑函数或 handle;为空表示不适用。

§field: String

Declaration field that failed its check; empty means not applicable. 未通过检查的声明字段;为空表示不适用。

§expected: String

Value the contract required; empty means not applicable. 契约要求的值;为空表示不适用。

§actual: String

Value actually observed; empty means not applicable. 实际观测到的值;为空表示不适用。

§provider: String

Kind of ancestor expected to provide the missing capability; empty means not applicable. 本应提供缺失能力的祖先类型;为空表示不适用。

§message: String

Human-readable failure summary; empty means no message applies. 人类可读的失败摘要;为空表示没有消息。

Implementations§

Source§

impl BuildDiagnostic

Source

pub fn new(phase: &'static str, message: impl Into<String>) -> BuildDiagnostic

Start a diagnostic in phase with its human-readable message. 以 phase 和人类可读消息开启一条诊断。

Every optional field starts empty, so the builder methods below attach only the facts this diagnostic actually has. 所有可选字段起始为空,由下面的 builder 方法只挂上该诊断真正具有的事实。

Source

pub fn at(self, source: impl Into<String>, line: usize) -> BuildDiagnostic

Attach the declaration source and its 1-based line; pass 0 for no line. 挂上声明源码与以 1 起始的行号;没有行号时传 0。

Source

pub fn node( self, node: impl Into<String>, kind: impl Into<String>, ) -> BuildDiagnostic

Attach the failing face identity and kind, stored together as node (kind). 挂上失败注册面的身份与类型,合并存储为 node (kind)。

Source

pub fn branch(self, branch: impl Into<String>) -> BuildDiagnostic

Attach the graft branch the failure belongs to. 挂上该失败所属的 graft 分支。

Source

pub fn function(self, function: impl Into<String>) -> BuildDiagnostic

Attach the logical function or handle the failure is about. 挂上该失败所针对的逻辑函数或 handle。

Source

pub fn field(self, field: impl Into<String>) -> BuildDiagnostic

Attach the declaration field that failed its check. 挂上未通过检查的声明字段。

Source

pub fn expected(self, expected: impl Into<String>) -> BuildDiagnostic

Attach the value the contract required. 挂上契约要求的值。

Source

pub fn actual(self, actual: impl Into<String>) -> BuildDiagnostic

Attach the value actually observed. 挂上实际观测到的值。

Source

pub fn provider(self, provider: impl Into<String>) -> BuildDiagnostic

Attach the kind of ancestor expected to provide the missing capability. 挂上本应提供缺失能力的祖先类型。

Trait Implementations§

Source§

impl Clone for BuildDiagnostic

Source§

fn clone(&self) -> BuildDiagnostic

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for BuildDiagnostic

Source§

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

Formats the value using the given formatter. Read more
Source§

impl Eq for BuildDiagnostic

Source§

impl PartialEq for BuildDiagnostic

Source§

fn eq(&self, other: &BuildDiagnostic) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for BuildDiagnostic

Auto Trait Implementations§

Blanket Implementations§

Source§

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

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

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

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

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

Source§

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

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

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

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

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

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

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

Source§

type Error = !

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, !>

Performs the conversion.
Source§

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

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.