lemma/serialization/mod.rs
1//! Serialization module for converting external data formats to string values.
2//!
3//! These functions convert data from external formats (JSON, MsgPack, Protobuf)
4//! into string values ready for use with `ExecutionPlan::with_values()`.
5//!
6//! - **null values** are skipped (treated as "fact not provided")
7//! - JSON numbers, booleans, arrays, objects are converted to their string representation
8//!
9//! # Example
10//!
11//! ```ignore
12//! use lemma::serialization::from_json;
13//!
14//! let json = br#"{"discount": 21, "config": {"key": "value"}, "name": null}"#;
15//! let values = from_json(json, &execution_plan)?;
16//! // discount -> "21"
17//! // config -> "{\"key\":\"value\"}"
18//! // name -> skipped (null)
19//! let plan = execution_plan.with_values(values, &limits)?;
20//! ```
21
22mod json;
23mod msgpack;
24mod protobuf;
25
26pub use json::from_json;
27pub use json::{
28 deserialize_fact_doc_ref_map, deserialize_fact_path_map, deserialize_fact_path_set,
29 deserialize_fact_source_map, deserialize_fact_type_map, deserialize_fact_value_map,
30 serialize_fact_doc_ref_map, serialize_fact_path_map, serialize_fact_path_set,
31 serialize_fact_source_map, serialize_fact_type_map, serialize_fact_value_map,
32};
33pub use msgpack::from_msgpack;
34pub use protobuf::from_protobuf;