pub struct Limits {
pub macro_time_budget: Duration,
pub hook_time_budget: Duration,
pub memory_limit_bytes: usize,
pub max_stack_bytes: usize,
}Expand description
Resource limits enforced on each JavaScript invocation.
Every field is applied to the engine that executes a single macro or hook
invocation (see crate::MacroRuntime).
Fields§
§macro_time_budget: DurationWall-clock budget for macro invocations
(crate::MacroRuntime::run_macro).
Enforced by a deadline-based interrupt handler: once the deadline
passes, the engine aborts the script with the QuickJS "interrupted"
error.
hook_time_budget: DurationWall-clock budget for post-compile hook invocations
(crate::MacroRuntime::run_hook).
memory_limit_bytes: usizeMaximum engine memory in bytes (JS_SetMemoryLimit semantics).
When the engine’s tracked allocations exceed the limit, the script
aborts with the "out of memory" error.
max_stack_bytes: usizeMaximum JavaScript stack size in bytes (JS_SetMaxStackSize semantics).
Deep recursion aborts with "Maximum call stack size exceeded".