Skip to main content

Diagnostic

Struct Diagnostic 

Source
#[non_exhaustive]
pub struct Diagnostic {
Show 13 fields pub trace_captured: bool, pub reason: Option<DiagnosticReason>, pub data_path: Option<String>, pub generated_source: bool, pub host_cause: Option<Arc<dyn Error + Send + Sync>>, pub source: Option<Arc<str>>, pub line: Option<u32>, pub unclosed_block: Option<(u32, &'static str)>, pub span: Option<DiagnosticSpan>, pub snapshot: Option<Arc<SourceSnapshot>>, pub report_bytes: usize, pub frames: Vec<DiagnosticFrame>, pub frames_truncated: bool,
}
Expand description

Source details and call frames that remain available after reset or drop.

This data is separate from the script’s error value and never changes what pcall receives. Source and frames may be absent when their budgets are zero.

Fields (Non-exhaustive)§

This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.
§trace_captured: bool

Whether runtime call-trace capture has been performed. This can be true even when no frames were retained.

§reason: Option<DiagnosticReason>

Structured facts from the failing operation, when they were captured.

§data_path: Option<String>

The field or array path associated with a data-conversion failure, when known.

§generated_source: bool

Whether the failure falls in generated wrapper text rather than mapped input.

§host_cause: Option<Arc<dyn Error + Send + Sync>>

The original typed host error, when a host cause was preserved.

§source: Option<Arc<str>>

The source label, when known; it need not name a file on disk.

§line: Option<u32>

The one-based source line, when known.

§unclosed_block: Option<(u32, &'static str)>

The one-based opening line and expected closing keyword for an unclosed block.

§span: Option<DiagnosticSpan>

The half-open source byte range, when known. A source map may adjust it to refer to the retained input rather than generated wrapper text.

§snapshot: Option<Arc<SourceSnapshot>>

Retained source text for this failure. It may be absent when the source or total retention budget is exceeded, allocation fails, or source is unavailable.

§report_bytes: usize

The maximum UTF-8 byte length of crate::Error::report output. This is a formatting budget, not the current report’s length; zero emits nothing.

§frames: Vec<DiagnosticFrame>

Captured caller frames, starting with the caller nearest the failure. An empty list can mean no callers, disabled capture, or unavailable frame data.

§frames_truncated: bool

Whether additional call frames were omitted when capture reached its bound.

Trait Implementations§

Source§

impl Clone for Diagnostic

Source§

fn clone(&self) -> Diagnostic

Returns a duplicate of the value. Read more
1.0.0 · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Debug for Diagnostic

Source§

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

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

impl Default for Diagnostic

Source§

fn default() -> Self

Returns the “default value” for a type. Read more

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 = Infallible

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

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

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.