Skip to main content

Config

Struct Config 

Source
#[non_exhaustive]
pub struct Config { pub iteration_profile: IterationProfile, pub effect_domain: u64, pub fuel_limit: Option<u64>, pub max_objects: u32, pub auto_gc: bool, pub gc_min_debt: u64, pub max_logical_heap: u64, pub max_stack_slots: u32, pub max_string_bytes: u64, pub max_snapshot_bytes: u64, pub entropy: u64, pub gc_mode: GcMode, }
Expand description

Runtime configuration, resource limits, and deterministic execution policy.

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.
§iteration_profile: IterationProfile

Order used by next, plain pairs, and host raw traversal. Defaults to IterationProfile::InsertionOrder; ipairs and __pairs are unchanged.

§effect_domain: u64

The host-selected lineage shared with the journal.

§fuel_limit: Option<u64>

An optional total execution fuel bound; restore rewinds the consumed counter. None allows up to u64::MAX total fuel. Further fueled work terminates with FuelLimitExceeded; the counter never wraps.

§max_objects: u32

Bound on live objects, in all kinds together (ADR 0052): an allocation past it raises a Lua memory error. Clamped to 1..=2^28.

§auto_gc: bool

Collect garbage automatically at safe points (ADR 0021).

§gc_min_debt: u64

Smallest allocation, in logical bytes, between automatic collections.

§max_logical_heap: u64

Hard quota on the logical heap, in logical bytes (ADR 0025). An allocation that would pass it raises a Lua memory error. Clamped to 1..=2^31 (ADR 0052).

§max_stack_slots: u32

Bound on each thread’s stack, in value slots (ADR 0028). A call or result that would pass it raises a Lua “stack overflow”. Clamped to 1,024..=100,000.

§max_string_bytes: u64

Bound on one string’s length, in bytes (ADR 0052). A string is also bounded by the quota; by default only by the quota. Clamped to 1,024..=2^30.

§max_snapshot_bytes: u64

Bound on a snapshot this runtime writes, in bytes (ADR 0052): a larger one is refused with SnapshotError::LimitExceeded. Host policy, not snapshot state. Clamped to 4,096..=2^31.

§entropy: u64

Start of the deterministic entropy stream that seeds math.random (ADR 0032): the same value gives the same random numbers.

§gc_mode: GcMode

The collector’s mode at boot (ADR 0051); Lua’s collectgarbage("incremental") and ("generational") change it.

Implementations§

Source§

impl Config

Source

pub fn limits(&self) -> Limits

The resource limits this configuration asks for, clamped as a runtime clamps them.

Trait Implementations§

Source§

impl Clone for Config

Source§

fn clone(&self) -> Self

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 Config

Source§

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

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

impl Default for Config

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

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.