pub struct Rule {
pub id: String,
pub priority: i32,
pub predicate: Predicate,
pub action: String,
pub metadata: Option<Map<String, Value>>,
}Expand description
An individual rule with conditions and action.
§Fields
id: Unique identifier for the rulepriority: Evaluation priority (lower = higher precedence, default: 0)predicate: Condition tree (deserialized fromconditionsfield)action: Action identifier (informational, not evaluated by engine)metadata: Optional metadata for tracing, compliance, or custom annotations
§JSON Format
{
"id": "Premium_User",
"priority": 1,
"conditions": {"user.tier": {"$equals": "Gold"}},
"action": "apply_discount",
"metadata": {
"source": "Pricing Rules v2.3",
"tags": ["premium", "discount"]
}
}The metadata field is optional and will be included in evaluation results if present.
Fields§
§id: String§priority: i32§predicate: Predicate§action: String§metadata: Option<Map<String, Value>>Trait Implementations§
Source§impl<'de> Deserialize<'de> for Rule
impl<'de> Deserialize<'de> for Rule
Source§fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
fn deserialize<D>(deserializer: D) -> Result<Self, D::Error>where
D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for Rule
impl RefUnwindSafe for Rule
impl Send for Rule
impl Sync for Rule
impl Unpin for Rule
impl UnwindSafe for Rule
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