Expand description
CEL (Common Expression Language) engine (DW-058).
This module provides a thin wrapper around the cel-interpreter
crate, offering:
CelProgram— a compiled CEL program (parse + type-check done at compile time, never on the request path).CelContext— a CEL evaluation context (variable bindings).CelValue— a CEL value (the result of evaluation).
§Design (decision 5; §9.3)
CEL expressions are compiled once at config publish time and
embedded in the snapshot as CelProgram instances. The request
path only evaluates — it never parses or compiles. This keeps the
hot path fast (the cel-interpreter’s tree-walking evaluator is
~100-500 ns/op for simple expressions, measured by the benchmark
in benches/micro.rs).
§AOT vs JIT
The issue scope mentions “cranelift JIT optional”. The current
implementation uses the cel-interpreter’s tree-walking evaluator
(no JIT). If the benchmark shows this is too slow for a given use
case, a cranelift JIT backend can be added behind a feature flag
without changing the API — CelProgram would hold either an AST
or JIT-compiled code, and CelProgram::evaluate would dispatch
accordingly.
§Feature gate
The cel cargo feature must be enabled. Without it, the module is
not compiled and config fields that reference CEL expressions are
accepted but inert.
Modules§
- everywhere
- CEL everywhere (DW-059).
- jit
- CEL JIT compilation via cranelift (PERF-09, #260).
Structs§
- CelContext
- A CEL evaluation context — variable bindings for evaluation.
- CelProgram
- A compiled CEL program.
- Parse
Error - Parse
Errors
Enums§
Functions§
- value_
to_ bool - Convert a CEL Value to a Rust bool, if possible.
- value_
to_ float - Convert a CEL Value to a Rust f64, if possible.
- value_
to_ int - Convert a CEL Value to a Rust i64, if possible.
- value_
to_ string - Convert a CEL Value to a Rust string, if possible.
Type Aliases§
- CelResult
- The result of evaluating a CEL expression.