pub struct Rule {
pub condition: Expression,
pub effects: Vec<Effect>,
pub source: String,
}Expand description
One compiled rule: a predicate plus the effects to fire when it matches.
effects is always non-empty for parser-produced rules. The
historical “single Allow/Deny” cases are represented by a one-element
Vec — slightly more allocation than a flat enum, but keeps one
dispatch path instead of two and eliminates the ambiguity of having
both Action::Allow and Effect::Allow in the IR.
Fields§
§condition: Expression§effects: Vec<Effect>§source: StringHuman-readable source (original YAML line, file path, etc.). Surfaces in audit logs and policy violation diagnostics.
Implementations§
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>,
Source§impl From<Rule> for Effect
Rule is structurally identical to Effect::When. The From impl lets
callers that already hold a Rule (notably the parser’s inner helpers
and the test fixtures) drop a .into() instead of re-spelling all
three fields. Bridges the few remaining producers while the migration
completes; will probably stay long-term because the parser still
builds Rule incrementally before deciding it’s an Effect::When.
impl From<Rule> for Effect
Rule is structurally identical to Effect::When. The From impl lets
callers that already hold a Rule (notably the parser’s inner helpers
and the test fixtures) drop a .into() instead of re-spelling all
three fields. Bridges the few remaining producers while the migration
completes; will probably stay long-term because the parser still
builds Rule incrementally before deciding it’s an Effect::When.