pub struct Diagnostic {
pub severity: Severity,
pub code: DiagnosticCode,
pub stage: DiagnosticStage,
pub message: Cow<'static, str>,
pub location: Option<OpLocation>,
pub suggested_fix: Option<Cow<'static, str>>,
pub cause: Option<DiagnosticCause>,
pub retry: RetryClass,
pub doc_url: Option<Cow<'static, str>>,
}Expand description
Serializable diagnostic shared by compiler, AOT, runtime, and drivers.
Fields§
§severity: SeveritySeverity of the diagnostic.
code: DiagnosticCodeStable machine-readable code.
stage: DiagnosticStageStage that produced the diagnostic.
message: Cow<'static, str>Deterministic failure detail.
location: Option<OpLocation>Typed source, graph, operation, or artifact location.
suggested_fix: Option<Cow<'static, str>>Corrective action the caller can apply.
cause: Option<DiagnosticCause>Structured cause retained from the owning stage.
retry: RetryClassRetry policy for this failure.
doc_url: Option<Cow<'static, str>>Optional stable documentation URL.
Implementations§
Source§impl Diagnostic
impl Diagnostic
Sourcepub fn error(
code: &'static str,
message: impl Into<Cow<'static, str>>,
) -> Diagnostic
pub fn error( code: &'static str, message: impl Into<Cow<'static, str>>, ) -> Diagnostic
Construct an error diagnostic at validation stage with no retry.
Sourcepub fn warning(
code: &'static str,
message: impl Into<Cow<'static, str>>,
) -> Diagnostic
pub fn warning( code: &'static str, message: impl Into<Cow<'static, str>>, ) -> Diagnostic
Construct a warning diagnostic at validation stage with no retry.
Sourcepub fn note(
code: &'static str,
message: impl Into<Cow<'static, str>>,
) -> Diagnostic
pub fn note( code: &'static str, message: impl Into<Cow<'static, str>>, ) -> Diagnostic
Construct a note diagnostic at validation stage with no retry.
Sourcepub const fn with_stage(self, stage: DiagnosticStage) -> Diagnostic
pub const fn with_stage(self, stage: DiagnosticStage) -> Diagnostic
Set the owning workflow stage.
Sourcepub fn with_location(self, location: OpLocation) -> Diagnostic
pub fn with_location(self, location: OpLocation) -> Diagnostic
Attach a typed location.
Sourcepub fn with_fix(self, fix: impl Into<Cow<'static, str>>) -> Diagnostic
pub fn with_fix(self, fix: impl Into<Cow<'static, str>>) -> Diagnostic
Attach a corrective action.
Sourcepub fn with_cause(
self,
kind: impl Into<String>,
detail: impl Into<String>,
) -> Diagnostic
pub fn with_cause( self, kind: impl Into<String>, detail: impl Into<String>, ) -> Diagnostic
Attach a structured cause.
Sourcepub const fn with_retry(self, retry: RetryClass) -> Diagnostic
pub const fn with_retry(self, retry: RetryClass) -> Diagnostic
Set the retry policy.
Sourcepub fn with_doc_url(self, url: impl Into<Cow<'static, str>>) -> Diagnostic
pub fn with_doc_url(self, url: impl Into<Cow<'static, str>>) -> Diagnostic
Attach a documentation URL.
Sourcepub fn render_human(&self) -> String
pub fn render_human(&self) -> String
Render a deterministic rustc-style diagnostic.
Trait Implementations§
Source§impl Clone for Diagnostic
impl Clone for Diagnostic
Source§fn clone(&self) -> Diagnostic
fn clone(&self) -> Diagnostic
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreSource§impl Debug for Diagnostic
impl Debug for Diagnostic
Source§impl<'de> Deserialize<'de> for Diagnostic
impl<'de> Deserialize<'de> for Diagnostic
Source§fn deserialize<__D>(
__deserializer: __D,
) -> Result<Diagnostic, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D,
) -> Result<Diagnostic, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
Source§impl Display for Diagnostic
impl Display for Diagnostic
impl Eq for Diagnostic
Source§impl From<&ValidationError> for Diagnostic
impl From<&ValidationError> for Diagnostic
Source§fn from(issue: &ValidationError) -> Diagnostic
fn from(issue: &ValidationError) -> Diagnostic
Source§impl From<ValidationError> for Diagnostic
impl From<ValidationError> for Diagnostic
Source§fn from(issue: ValidationError) -> Diagnostic
fn from(issue: ValidationError) -> Diagnostic
Source§impl PartialEq for Diagnostic
impl PartialEq for Diagnostic
Source§impl Serialize for Diagnostic
impl Serialize for Diagnostic
Source§fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S,
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl StructuralPartialEq for Diagnostic
Auto Trait Implementations§
impl Freeze for Diagnostic
impl RefUnwindSafe for Diagnostic
impl Send for Diagnostic
impl Sync for Diagnostic
impl Unpin for Diagnostic
impl UnsafeUnpin for Diagnostic
impl UnwindSafe for Diagnostic
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.