RuleState

Trait RuleState 

Source
pub trait RuleState {
    // Required method
    fn get_rule_state(&self) -> &RuleStateBase;

    // Provided methods
    fn severity(&self) -> i32 { ... }
    fn related_rules(&self) -> HashMap<&String, &Vec<String>> { ... }
    fn related_unique_ids(&self) -> HashMap<&String, &Vec<String>> { ... }
}
Expand description

A trait representing a possible state of a Rule.

A Rule can have multiple states that affect agent behavior. This trait provides a common interface for accessing the properties shared by all rule states, such as severity and related rules.

This trait is implemented by specific state types like DiscreteValue and Range.

§Implementors

When implementing this trait, you must provide an implementation for the [get_rule_state()] method, which gives access to the underlying RuleStateBase data. The other methods have default implementations.

Required Methods§

Source

fn get_rule_state(&self) -> &RuleStateBase

Gets the underlying RuleStateBase that contains common state properties.

§Returns

A reference to the RuleStateBase that contains the severity, related rules, and related unique ids for the rule state.

Provided Methods§

Source

fn severity(&self) -> i32

Returns the severity of the rule state.

§Returns

An i32 representing the severity of the rule state. The severity is a numeric value that indicates the importance or urgency of the rule. The lower the value, the more strictly the rule is enforced.

Source

fn related_rules(&self) -> HashMap<&String, &Vec<String>>

Returns a map of related rules ids. The key is the group name and the value is a vector of rule ids.

§Returns

A map of related rules where the key is the group name and the value is a vector of rule ids.

Source

fn related_unique_ids(&self) -> HashMap<&String, &Vec<String>>

Returns a map of related unique ids. The key is the group name and the value is a vector of unique ids.

§Returns

A map of related unique ids where the key is the group name and the value is a vector of unique ids.

Implementors§