Skip to main content

DiagnosticLimits

Struct DiagnosticLimits 

Source
#[non_exhaustive]
pub struct DiagnosticLimits { pub retained_source_bytes: usize, pub source_bytes: usize, pub frames: usize, pub report_bytes: usize, }
Expand description

Host-side reporting budgets, separate from script fuel and memory limits.

Start with default and adjust the limits your application needs. Defaults are 4 MiB of retained-source accounting, 256 KiB per source, 32 captured frames, and 16 KiB per formatted report. These limits do not constrain script execution or change the error value received by pcall. A zero source budget omits nonempty source text while retaining available locations; zero frames disables frame storage, and zero report bytes produces an empty report for captured diagnostics. Errors without captured diagnostics use the formatter’s fallback budget instead.

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.
§retained_source_bytes: usize

Total budget for retained source snapshots, including accounting overhead, shared by compiled scripts and outstanding errors. Measured in bytes.

§source_bytes: usize

Maximum source length in bytes retained for one script. A larger source is omitted rather than stored as a partial snapshot.

§frames: usize

Maximum number of captured script frames.

§report_bytes: usize

Maximum bytes written by a formatted error report.

Implementations§

Source§

impl DiagnosticLimits

Source

pub fn new() -> Self

Uses the default source, frame, and report budgets.

Source

pub const fn retained_source_bytes(&self) -> usize

Returns the total retained-source budget.

Source

pub const fn source_bytes(&self) -> usize

Returns the largest source retained for one script.

Source

pub const fn frames(&self) -> usize

Returns the maximum captured frame count.

Source

pub const fn report_bytes(&self) -> usize

Returns the maximum formatted report size.

Source

pub const fn with_retained_source_bytes(self, bytes: usize) -> Self

Sets the total retained-source budget.

Source

pub const fn with_source_bytes(self, bytes: usize) -> Self

Sets the maximum source size retained for one script.

Source

pub const fn with_frames(self, frames: usize) -> Self

Sets the number of frames captured for one error.

Source

pub const fn with_report_bytes(self, bytes: usize) -> Self

Sets the maximum formatted report size.

Trait Implementations§

Source§

impl Clone for DiagnosticLimits

Source§

fn clone(&self) -> DiagnosticLimits

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 DiagnosticLimits

Source§

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

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

impl Default for DiagnosticLimits

Source§

fn default() -> Self

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

impl PartialEq for DiagnosticLimits

Source§

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

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

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

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl Copy for DiagnosticLimits

Source§

impl Eq for DiagnosticLimits

Source§

impl StructuralPartialEq for DiagnosticLimits

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.