Struct sim::mechanics::queue::Queue [−][src]
A Queue of vehicles on a single lane or turn. No over-taking or lane-changing. This is where https://a-b-street.github.io/docs/trafficsim/discrete_event.html#exact-positions is implemented.
Fields
id: Traversable
cars: VecDeque<CarID>
laggy_head: Option<CarID>
This car's back is still partly in this queue.
geom_len: Distance
reserved_length: Distance
When a car's turn is accepted, reserve the vehicle length + FOLLOWING_DISTANCE for the target lane. When the car completely leaves (stops being the laggy_head), free up that space. To prevent blocking the box for possibly scary amounts of time, allocate some of this length first. This is unused for turns themselves. This value can exceed geom_len (for the edge case of ONE long car on a short queue).
Implementations
impl Queue
[src]
pub fn new(id: Traversable, map: &Map) -> Queue
[src]
pub fn get_last_car_position(
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Option<(CarID, Distance)>
[src]
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Option<(CarID, Distance)>
pub fn get_car_positions(
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Vec<(CarID, Distance)>
[src]
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Vec<(CarID, Distance)>
Farthest along (greatest distance) is first.
fn inner_get_last_car_position(
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>,
recursed_queues: &mut BTreeSet<Traversable>,
intermediate_results: Option<&mut Vec<(CarID, Distance)>>
) -> Option<(CarID, Distance)>
[src]
&self,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>,
recursed_queues: &mut BTreeSet<Traversable>,
intermediate_results: Option<&mut Vec<(CarID, Distance)>>
) -> Option<(CarID, Distance)>
pub fn get_idx_to_insert_car(
&self,
start_dist: Distance,
vehicle_len: Distance,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Option<usize>
[src]
&self,
start_dist: Distance,
vehicle_len: Distance,
now: Time,
cars: &FixedMap<CarID, Car>,
queues: &HashMap<Traversable, Queue>
) -> Option<usize>
pub fn try_to_reserve_entry(&mut self, car: &Car, force_entry: bool) -> bool
[src]
If true, there's room and the car must actually start the turn (because the space is reserved).
pub fn is_overflowing(&self) -> bool
[src]
pub fn room_for_car(&self, car: &Car) -> bool
[src]
pub fn free_reserved_space(&mut self, car: &Car)
[src]
pub fn target_lane_penalty(&self) -> (usize, usize)
[src]
pub fn get_leader(&self, id: CarID) -> Option<CarID>
[src]
Find the vehicle in front of the specified input. None if this vehicle isn't in the queue at all, or they're the front (with or without a laggy head).
Trait Implementations
impl Clone for Queue
[src]
impl Debug for Queue
[src]
impl<'de> Deserialize<'de> for Queue
[src]
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for Queue
[src]
Auto Trait Implementations
impl RefUnwindSafe for Queue
[src]
impl Send for Queue
[src]
impl Sync for Queue
[src]
impl Unpin for Queue
[src]
impl UnwindSafe for Queue
[src]
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,
impl<T> Downcast for T where
T: Any,
T: Any,
pub fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn as_any(&self) -> &(dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
impl<T> DowncastSync for T where
T: Send + Sync + Any,
T: Send + Sync + Any,
impl<T> From<T> for T
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T> Instrument for T
[src]
pub fn instrument(self, span: Span) -> Instrumented<Self>
[src]
pub fn in_current_span(self) -> Instrumented<Self>
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,