1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
//! Input adapter for [`crate::Engine::compile`] and the module-level
//! [`crate::compile`].
//!
//! [`IntoLogic`] mirrors [`crate::EvalInput`] but on the *rule* side: it
//! lets a single `compile` entry point accept any of the rule shapes a
//! caller is likely to have on hand.
//!
//! - `&str` — JSON-parsed via `OwnedDataValue::from_json`.
//! - `&OwnedDataValue` — cloned (cheap; usually just an `Arc` bump in
//! practice).
//! - `OwnedDataValue` — moved.
//! - `&serde_json::Value` (`serde_json`) — deep-converted.
//! - `&T: Serialize` (`serde_json`) — routed via `serde_json::to_value`.
//!
//! The trait is **sealed**. The supported set is closed.
use OwnedDataValue;
use crateResult;
/// Convert `self` into an [`OwnedDataValue`] suitable for compilation.
///
/// Sealed trait — the supported input shapes are listed in this file;
/// external crates cannot add new ones.
// Note: a blanket `impl<T: Serialize> IntoLogic for &T` would conflict
// with the per-type impls above (every &T is also an &T: Serialize when
// `serde` is in scope). So there is no blanket impl and no typed-Serialize
// constructor: a caller holding a `&T: Serialize` converts it first with
// `serde_json::to_value(&t)?` (yielding a `serde_json::Value`, which does
// impl `IntoLogic`) and passes that to `Engine::compile`.