DiscreteValueRuleStateProvider

Struct DiscreteValueRuleStateProvider 

Source
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>

Source

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.

Source

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 type rule_type around the road_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.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.