pub struct DiscreteValueRuleStateProvider<'a> { /* private fields */ }Expand description
Provides the dynamic state of DiscreteValueRules.
While a RoadRulebook provides the static definitions of rules, a
DiscreteValueRuleStateProvider provides the current state of those rules
at runtime. This allows for querying what state a rule is currently in,
which is essential for dynamic systems where rule states can change over
time (e.g., traffic light phases changing).
Implementations§
Source§impl<'a> DiscreteValueRuleStateProvider<'a>
impl<'a> DiscreteValueRuleStateProvider<'a>
Sourcepub fn get_state_by_rule_id(
&self,
rule_id: &String,
) -> Option<StateProviderQuery<DiscreteValue>>
pub fn get_state_by_rule_id( &self, rule_id: &String, ) -> Option<StateProviderQuery<DiscreteValue>>
Gets a state from the provider based on it’s rule_id.
§Arguments
rule_id- A Rule ID.
§Returns
An Option containing the StateProviderQuery with a DiscreteValue if the rule_id matches with any rule.
Otherwise, None is returned.
Sourcepub fn get_state_by_rule_type(
&self,
road_position: &RoadPosition,
rule_type: RuleType,
tolerance: f64,
) -> Option<StateProviderQuery<DiscreteValue>>
pub fn get_state_by_rule_type( &self, road_position: &RoadPosition, rule_type: RuleType, tolerance: f64, ) -> Option<StateProviderQuery<DiscreteValue>>
Gets a state from the provider if there is a rule_type in the received road_position.
§Arguments
road_position- A position in the road geometry.rule_type- A Rule Type.tolerance- The tolerance in which to look for the Rule of typerule_typearound theroad_position.
§Returns
An Option containing the StateProviderQuery with a DiscreteValue if rule_type matches with any rule’s type near road_position.
Otherwise, None is returned.