Expand description
Arb’s computational substrate: arithmetic expressions are compiled to a
fusevm::Chunk and executed on the fusevm VM (Cranelift JIT for hot chunks).
This is what “arb runs on fusevm” means concretely — every computed value in
a spec flows through fusevm bytecode, not a bespoke evaluator.
x is the pipeline input scalar; a bareword identifier (amount, latency)
is a field of the current record, resolved by the caller’s closure. Both are
baked into the chunk as constants per evaluation, so no VM slot state is
assumed across run().
Comparisons (== != < <= > >=) lower to fusevm’s Num* ops and yield a
boolean; eval_pred reads the result via Value::is_truthy for where.
Enums§
Functions§
- chunk_
of - Lower
eto the fusevm chunkeval_ctxwould run, without running it. - control_
names - Collect the names of every
Controlreference ine(e.g..th-> “th”). - control_
names_ typed - Split control refs by the type they resolve to:
Match/InSetinners are string controls, everything else is numeric. Letsresolve_pipelinerequire numeric controls to resolve (or drop the filter) while string controls with an empty value simply match everything. - eval
- Evaluate as a number with no field resolver (field refs -> NaN).
- eval_
ctx - Lower
eto a fusevm chunk (withxand resolved fields baked in), run it on the VM, and return the resulting number.resolvemaps a field name to its numeric value. - eval_
pred - Evaluate as a predicate with no field resolver.
- eval_
pred_ ctx - Evaluate
eas a predicate — compiled to fusevm, run on the VM, read as a boolean viaValue::is_truthy.resolvemaps a field name to its value. - expr_
has_ str - Whether
econtains a string predicate (match/in .set) — the query layer routes such awhereto the Rust evaluator instead of the numeric VM. - parse
- Parse an expression: numbers,
x,+ - * / %, comparisons (== != < <= > >=), unary-, and parentheses. - prefix_
controls - Rewrite every
Control(name)inetoControl("{ns}.{name}"), in place — used byimport X as Yto namespace a module’s control references. - substitute_
controls - Return a copy of
ewith control refs substituted: a numericControl->Num(num(n))when resolvable (else left as-is -> NaN); a string control insidematch/in .set->Str(strv(n))(empty when unset -> matches all).