Intersection

Struct Intersection 

Source
pub struct Intersection<'a> { /* private fields */ }
Expand description

An abstract convenience class that aggregates information pertaining to an intersection. Its primary purpose is to serve as a single source of this information and to remove the need for users to query numerous disparate data structures and state providers.

Implementations§

Source§

impl<'a> Intersection<'a>

Source

pub fn id(&self) -> String

Returns the id of the Intersection as a string.

Source

pub fn phase(&self) -> StateProviderQuery<String>

Returns the current phase of the Intersection.

Based on the current phase, it returns a rules::StateProviderQuery with the phase’s ID and the next state.

§Returns

A rules::StateProviderQuery for the current rules::Phase.

Source

pub fn region(&self) -> Vec<LaneSRange>

Returns the region of the RoadNetwork that is considered part of the Intersection.

§Returns

A vector of LaneSRanges where the intersection lives.

Source

pub fn phase_ring_id(&self) -> String

Returns the ID of the rules::PhaseRing that applies to this intersection.

§Returns

A String with the ID of a rules::PhaseRing.

Source

pub fn bulb_ids(&self) -> Vec<UniqueBulbId>

Source

pub fn get_bulb_state(&self, unique_bulb_id: &UniqueBulbId) -> Option<BulbState>

Returns the current rules::BulbStates within the Intersection.

§Returns

A vector of rules::BulbStates.

Source

pub fn discrete_value_rule_states(&self) -> Vec<DiscreteValueRuleState>

Returns the current discrete value rule states within the intersection.

Source

pub fn includes_traffic_light(&self, traffic_light_id: &str) -> bool

Determines whether the rules::TrafficLight is within this Intersection.

§Arguments
§Returns

True when traffic_light_id is within this Intersection.

Source

pub fn includes_discrete_value_rule(&self, rule_id: &str) -> bool

Determines whether the rules::DiscreteValueRule is within this Intersection.

§Arguments
§Returns

True when rule_id is within this Intersection.

Source

pub fn includes_inertial_position( &self, inertial_position: &InertialPosition, road_geometry: &RoadGeometry<'_>, ) -> bool

Determines whether inertial_position is within this Intersection::region.

inertial_position is contained if the distance to the closest LanePosition in Intersection::region is less or equal than the linear tolerance of the road_geometry.

§Arguments
§Returns

True when inertial_position is within Intersection::region. False otherwise.

Auto Trait Implementations§

§

impl<'a> Freeze for Intersection<'a>

§

impl<'a> RefUnwindSafe for Intersection<'a>

§

impl<'a> !Send for Intersection<'a>

§

impl<'a> !Sync for Intersection<'a>

§

impl<'a> Unpin for Intersection<'a>

§

impl<'a> UnwindSafe for Intersection<'a>

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.