pub struct JetroEngine { /* private fields */ }Expand description
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.
Implementations§
Source§impl JetroEngine
impl JetroEngine
Sourcepub fn with_plan_cache_limit(plan_cache_limit: usize) -> Self
pub fn with_plan_cache_limit(plan_cache_limit: usize) -> Self
Create a JetroEngine with an explicit plan-cache capacity.
Set plan_cache_limit to 0 to disable caching entirely.
Sourcepub fn clear_cache(&self)
pub fn clear_cache(&self)
Discard all cached query plans, forcing re-compilation on the next call.
Sourcepub fn collect<S: AsRef<str>>(
&self,
document: &Jetro,
expr: S,
) -> Result<Value, EvalError>
pub fn collect<S: AsRef<str>>( &self, document: &Jetro, expr: S, ) -> Result<Value, EvalError>
Evaluate a Jetro expression against an already-constructed Jetro document,
using the engine’s shared plan cache and VM.
Sourcepub fn collect_value<S: AsRef<str>>(
&self,
document: Value,
expr: S,
) -> Result<Value, EvalError>
pub fn collect_value<S: AsRef<str>>( &self, document: Value, expr: S, ) -> Result<Value, EvalError>
Convenience wrapper: wrap a serde_json::Value in a Jetro and evaluate expr.
Sourcepub fn collect_bytes<S: AsRef<str>>(
&self,
bytes: Vec<u8>,
expr: S,
) -> Result<Value, JetroEngineError>
pub fn collect_bytes<S: AsRef<str>>( &self, bytes: Vec<u8>, expr: S, ) -> Result<Value, JetroEngineError>
Parse raw JSON bytes into a Jetro document and evaluate expr,
returning a JetroEngineError on either parse or evaluation failure.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for JetroEngine
impl RefUnwindSafe for JetroEngine
impl Send for JetroEngine
impl Sync for JetroEngine
impl Unpin for JetroEngine
impl UnsafeUnpin for JetroEngine
impl UnwindSafe for JetroEngine
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more