Skip to main content

Crate jetro_core

Crate jetro_core 

Source
Expand description

Jetro core — parser, compiler, and VM for the Jetro JSON query language.

§Execution path

source text
  │  parse::parser::parse() → Expr AST
  │  plan::physical::plan_query() → QueryPlan (physical IR)
  │  exec::router::collect_*() → dispatches to:
  │    StructuralIndex backend  (jetro-experimental bitmap)
  │    ViewPipeline backend     (borrowed tape/Val navigation)
  │    Pipeline backend         (pull-based composed stages)
  └─  VM fallback               (bytecode stack machine)

§Quick start

use jetro_core::Jetro;
let j = Jetro::from_bytes(br#"{"books":[{"price":12}]}"#.to_vec()).unwrap();
assert_eq!(j.collect("$.books.len()").unwrap(), serde_json::json!(1));

Macros§

for_each_builtin
Expands $macro!(...) once per BuiltinMethod variant — the single source of truth for “all builtin methods” used by name lookup, registry exports, and any future cross-cutting per-method generation. Variant names match the corresponding defs::* struct names.

Structs§

EvalError
Evaluation error carrying a human-readable message. Propagated through Result<Val, EvalError> across all execution layers.
Jetro
Primary entry point. Holds a JSON document and evaluates expressions against it. Lazy fields (root_val, tape, structural_index, objvec_cache) are populated on first use so callers only pay for the representations a particular query actually needs.
JetroEngine
Long-lived multi-document query engine with an explicit plan cache. Use when the same process evaluates many expressions over many documents — parse/lower/compile work is amortised by this object, not hidden in thread-local state.

Enums§

JetroEngineError
Error returned by JetroEngine::collect_bytes and similar methods that may fail during JSON parsing or during expression evaluation.