pub struct Limits {
pub rule_timeout: Duration,
pub global_timeout: Duration,
pub analysis_timeout: Duration,
pub memory_bytes: usize,
}Expand description
The three budgets.
Fields§
§rule_timeout: DurationBudget for one handler invocation — a single check or reduce call.
This is the limit that fires fast and names the culprit: which rule, which file, which phase. Keeping it well under the global budget means the diagnostic usually comes from the level that can identify the cause.
global_timeout: DurationWall-clock budget for the whole run.
The backstop for when no single invocation is pathological but the aggregate is — a thousand rules each taking twenty milliseconds.
analysis_timeout: DurationBudget for host-side type-provider work across the whole run.
Analysis time, not elapsed time: the sum of what the provider spends building
programs and answering requests, as AnalysisBudget accumulates it, and not the
wall clock since the run started. A run’s own reading, parsing, matching and rule
execution are global_timeout’s business and are charged nowhere here.
Separate from global_timeout because it bounds host work rather than guest
execution, and the two must not subsidize each other: a program build charged to the
run budget would make a cold tsc run and a warm one take different exits over
identical input, which is exactly the reasoning architecture §6.8 gives for taking
component compilation off the run clock.
memory_bytes: usizeMemory ceiling per runtime.
Implementations§
Source§impl Limits
impl Limits
Sourcepub const fn with_rule_timeout(self, timeout: Duration) -> Self
pub const fn with_rule_timeout(self, timeout: Duration) -> Self
Raise the per-invocation budget, for a rule that legitimately does heavy work.
Cannot raise the global budget: a single rule must not be able to extend the run’s total. That is the whole point of having two levels rather than one.
Sourcepub const fn with_global_timeout(self, timeout: Duration) -> Self
pub const fn with_global_timeout(self, timeout: Duration) -> Self
Set the global wall-clock budget.
Sourcepub const fn with_memory_bytes(self, bytes: usize) -> Self
pub const fn with_memory_bytes(self, bytes: usize) -> Self
Set the per-runtime memory ceiling.
Sourcepub const fn with_analysis_timeout(self, timeout: Duration) -> Self
pub const fn with_analysis_timeout(self, timeout: Duration) -> Self
Set the analysis budget.