json_eval_rs/lib.rs
1//! JSON Eval RS - high-performance JSON Logic and schema evaluation.
2//!
3//! Main public entry points are re-exported from this crate root:
4//! [`JSONEval`] for schema evaluation, [`ParsedSchema`] for reusable parsed schemas,
5//! [`ParsedSchemaCache`] for cache-backed reuse, and [`RLogic`] for lower-level JSON
6//! Logic compilation/evaluation.
7//!
8//! Module map:
9//! - [`jsoneval`] owns schema parsing, evaluation, layout resolution, validation, and caches.
10//! - [`rlogic`] owns the JSON Logic compiler/evaluator used by schema evaluation.
11//! - [`parse_schema`] and [`topo_sort`] preserve legacy parsing/sorting entry points.
12//! - [`utils`] contains crate-wide timing/debug helpers and numeric cleanup utilities.
13//! - `ffi` and `wasm` expose binding layers behind feature flags.
14
15// Use mimalloc allocator on Windows for better performance
16#[cfg(windows)]
17#[global_allocator]
18static GLOBAL: mimalloc::MiMalloc = mimalloc::MiMalloc;
19
20pub mod parse_schema;
21pub mod rlogic;
22pub mod topo_sort;
23
24pub mod jsoneval;
25#[macro_use]
26pub mod utils;
27
28// FFI module for C# and other languages
29#[cfg(feature = "ffi")]
30pub mod ffi;
31
32// WebAssembly module for JavaScript/TypeScript
33#[cfg(feature = "wasm")]
34pub mod wasm;
35
36// Re-export stable public Rust API from focused internal modules.
37pub use jsoneval::eval_data::EvalData;
38pub use jsoneval::parsed_schema::ParsedSchema;
39pub use jsoneval::parsed_schema_cache::{
40 ParsedSchemaCache, ParsedSchemaCacheStats, PARSED_SCHEMA_CACHE,
41};
42pub use jsoneval::path_utils::ArrayMetadata;
43pub use jsoneval::table_metadata::TableMetadata;
44pub use rlogic::{
45 CompiledLogic, CompiledLogicId, CompiledLogicStore, CompiledLogicStoreStats, Evaluator,
46 LogicId, RLogic, RLogicConfig,
47};
48
49pub use jsoneval::types::*;
50pub use jsoneval::JSONEval;
51pub use utils::*;
52
53/// Get the library version
54pub fn version() -> &'static str {
55 env!("CARGO_PKG_VERSION")
56}