pub struct TrafficLight { /* private fields */ }
Expand description
A set of coordinated traffic lights.
Implementations§
Source§impl TrafficLight
impl TrafficLight
Sourcepub fn add_movement(
&mut self,
amber_time: f64,
links: impl Iterator<Item = LinkId>,
)
pub fn add_movement( &mut self, amber_time: f64, links: impl Iterator<Item = LinkId>, )
Adds a movement to the traffic light, which is a group of one or more links controlled by the same signal head(s) and so go and stop together.
§Parameters
amber_time
- The duration of the amber phase of this movement, in seconds.links
- An iterator which produces the set of links that belong to this movement.
Sourcepub fn add_conflict(&mut self, subject: usize, other: usize, wait: f64)
pub fn add_conflict(&mut self, subject: usize, other: usize, wait: f64)
Adds a conflict between two movements to the traffic light.
Sourcepub fn add_phase(&mut self, mask: u64, duration: f64)
pub fn add_phase(&mut self, mask: u64, duration: f64)
Adds a phase to the traffic light timing.
Sourcepub fn get_states(&self) -> impl Iterator<Item = (LinkId, TrafficControl)> + '_
pub fn get_states(&self) -> impl Iterator<Item = (LinkId, TrafficControl)> + '_
Gets the current state of each link
Trait Implementations§
Source§impl Clone for TrafficLight
impl Clone for TrafficLight
Source§fn clone(&self) -> TrafficLight
fn clone(&self) -> TrafficLight
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl Default for TrafficLight
impl Default for TrafficLight
Source§fn default() -> TrafficLight
fn default() -> TrafficLight
Returns the “default value” for a type. Read more
Source§impl<'de> Deserialize<'de> for TrafficLight
impl<'de> Deserialize<'de> for TrafficLight
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Auto Trait Implementations§
impl Freeze for TrafficLight
impl !RefUnwindSafe for TrafficLight
impl Send for TrafficLight
impl !Sync for TrafficLight
impl Unpin for TrafficLight
impl UnwindSafe for TrafficLight
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read more