RuleDefinition

Trait RuleDefinition 

Source
pub trait RuleDefinition:
    Clone
    + Debug
    + Display
    + PartialEq
    + Hash
    + Eq {
    type Action: ActionDefinition;
    type Guard: VariableConstraint;

    // Required methods
    fn id(&self) -> u32;
    fn source(&self) -> &Location;
    fn target(&self) -> &Location;
    fn guard(&self) -> &Self::Guard;
    fn actions(&self) -> impl Iterator<Item = &Self::Action>;

    // Provided methods
    fn has_decrements(&self) -> bool { ... }
    fn has_resets(&self) -> bool { ... }
}
Expand description

Trait implemented by all flavors of rules

Trait for common functionality of rules. This trait is implemented for the general_threshold_automaton::Rule type for general_threshold_automaton::GeneralThresholdAutomaton and lia_threshold_automaton::LIARule for lia_threshold_automaton::LIAThresholdAutomaton.

Required Associated Types§

Source

type Action: ActionDefinition

Type of the actions of the rule

Source

type Guard: VariableConstraint

Type of the guard of the rule

Required Methods§

Source

fn id(&self) -> u32

Returns the id of the rule

The id is a unique identifier assigned to the rule in the specification. It is used to refer to the rule in the specification.

Source

fn source(&self) -> &Location

Returns the source location of the rule

The source location is the location from which the rule transitions to the target location.

Source

fn target(&self) -> &Location

Returns the target location of the rule

The target location is the location to which the rule transitions from the source location.

Source

fn guard(&self) -> &Self::Guard

Returns the guard of the rule

The guard is a boolean expression over shared variables that must be satisfied for the rule to be enabled.

Source

fn actions(&self) -> impl Iterator<Item = &Self::Action>

Returns the actions of the rule

The actions are the updates to shared variables that are performed when the rule is executed.

Provided Methods§

Source

fn has_decrements(&self) -> bool

Check whether the rule has a decrement action

Source

fn has_resets(&self) -> bool

Check whether the rule has a reset action

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§