pub struct ResourceLimits {
pub max_source_size_bytes: usize,
pub max_expression_depth: usize,
pub max_expression_count: usize,
pub max_total_expression_count: usize,
pub max_data_value_bytes: usize,
pub max_loaded_bytes: usize,
pub max_sources: usize,
pub max_normalized_expression_nodes: usize,
}Expand description
Limits to prevent abuse and enable predictable resource usage
These limits protect against malicious inputs while being generous enough for all legitimate use cases.
Fields§
§max_source_size_bytes: usizeMaximum size of one loaded source text in bytes. Real usage: ~5KB, Limit: 5MB (1000x)
max_expression_depth: usizeMaximum expression nesting depth Real usage: ~3 levels, Limit: 7. Deeper logic via rule composition.
max_expression_count: usizeMaximum expression nodes per source (parser-level) Quick-reject for pathological single sources.
max_total_expression_count: usizeMaximum total expression nodes across all sources (engine-level) The real capacity ceiling. pi (~3.1M) — generous for national-scale regulatory systems while bounding total engine workload.
max_data_value_bytes: usizeMaximum size of a single data value in bytes Real usage: ~100 bytes, Limit: 1KB (10x) Enables server pre-allocation for zero-allocation evaluation
max_loaded_bytes: usizeMaximum total bytes to load in one batch (and/or in-memory size of loaded specs)
max_sources: usizeMaximum number of sources in one load batch (e.g. after expanding paths on disk)
max_normalized_expression_nodes: usizeMaximum expression nodes for one rule after transitive rule inlining during planning. Inlining materializes shared subtrees, so a short chain of self-doubling rules grows exponentially; this limit rejects such chains with a planning error before any tree is materialized.
The default is chosen so the compiled instruction operands always fit
u16: compilation allocates at most two registers (and at most one
constant/data/veto table entry) per node, and normalization passes
grow the tree by at most a small constant factor, so 30,000 nodes
stays well below the 65,535 register ceiling.
Trait Implementations§
Source§impl Clone for ResourceLimits
impl Clone for ResourceLimits
Source§fn clone(&self) -> ResourceLimits
fn clone(&self) -> ResourceLimits
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read more