pub struct PolicyRuleSet {
pub rules: Vec<PolicyRule>,
}Expand description
A set of policy rules loaded from YAML.
Fields§
§rules: Vec<PolicyRule>Implementations§
Source§impl PolicyRuleSet
impl PolicyRuleSet
Sourcepub fn evaluate(&self, ctx: &RuleContext) -> Option<RuleAction>
pub fn evaluate(&self, ctx: &RuleContext) -> Option<RuleAction>
Evaluate rules against a context. Returns the first matching rule’s action, or None if no rules match.
Sourcepub fn add_rule(&mut self, rule: PolicyRule)
pub fn add_rule(&mut self, rule: PolicyRule)
Add a rule to the set.
Sourcepub fn remove_rule(&mut self, name: &str) -> bool
pub fn remove_rule(&mut self, name: &str) -> bool
Remove a rule by name.
Trait Implementations§
Source§impl Clone for PolicyRuleSet
impl Clone for PolicyRuleSet
Source§fn clone(&self) -> PolicyRuleSet
fn clone(&self) -> PolicyRuleSet
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PolicyRuleSet
impl Debug for PolicyRuleSet
Source§impl<'de> Deserialize<'de> for PolicyRuleSet
impl<'de> Deserialize<'de> for PolicyRuleSet
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 PolicyRuleSet
impl RefUnwindSafe for PolicyRuleSet
impl Send for PolicyRuleSet
impl Sync for PolicyRuleSet
impl Unpin for PolicyRuleSet
impl UnsafeUnpin for PolicyRuleSet
impl UnwindSafe for PolicyRuleSet
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