Struct sim::transit::TransitSimState [−][src]
pub(crate) struct TransitSimState { buses: BTreeMap<CarID, Bus>, routes: BTreeMap<BusRouteID, Route>, peds_waiting: BTreeMap<BusStopID, Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>>, events: Vec<Event>, }
Manages public transit vehicles (buses and trains) that follow a route. The transit model is currently kind of broken, so not describing the state machine yet.
Fields
buses: BTreeMap<CarID, Bus>
routes: BTreeMap<BusRouteID, Route>
peds_waiting: BTreeMap<BusStopID, Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>>
waiting at => (ped, route, bound for, started waiting)
events: Vec<Event>
Implementations
impl TransitSimState
[src]
impl TransitSimState
[src]pub fn new(map: &Map) -> TransitSimState
[src]
pub fn create_empty_route(&mut self, bus_route: &BusRoute, map: &Map) -> Path
[src]
Returns the path for the first leg.
pub fn bus_created(&mut self, bus: CarID, r: BusRouteID)
[src]
pub fn bus_arrived_at_stop(
&mut self,
now: Time,
id: CarID,
trips: &mut TripManager,
walking: &mut WalkingSimState,
ctx: &mut Ctx<'_>
) -> bool
[src]
&mut self,
now: Time,
id: CarID,
trips: &mut TripManager,
walking: &mut WalkingSimState,
ctx: &mut Ctx<'_>
) -> bool
If true, the bus is idling. If false, the bus actually arrived at a border and should now vanish.
pub fn bus_departed_from_stop(&mut self, id: CarID, map: &Map) -> Router
[src]
pub fn ped_waiting_for_bus(
&mut self,
now: Time,
ped: PedestrianID,
trip: TripID,
person: PersonID,
stop1: BusStopID,
route_id: BusRouteID,
maybe_stop2: Option<BusStopID>,
map: &Map
) -> Option<CarID>
[src]
&mut self,
now: Time,
ped: PedestrianID,
trip: TripID,
person: PersonID,
stop1: BusStopID,
route_id: BusRouteID,
maybe_stop2: Option<BusStopID>,
map: &Map
) -> Option<CarID>
Returns the bus if the pedestrian boarded immediately.
pub fn collect_events(&mut self) -> Vec<Event>
[src]
pub fn get_passengers(&self, bus: CarID) -> &Vec<(PersonID, Option<BusStopID>)>
[src]
pub fn bus_route(&self, bus: CarID) -> BusRouteID
[src]
pub fn buses_for_route(&self, route: BusRouteID) -> Vec<(CarID, Option<usize>)>
[src]
also stop idx that the bus is coming from
pub fn active_vehicles(&self) -> (usize, usize)
[src]
(buses, trains)
pub fn get_people_waiting_at_stop(
&self,
at: BusStopID
) -> &Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>
[src]
&self,
at: BusStopID
) -> &Vec<(PedestrianID, BusRouteID, Option<BusStopID>, Time)>
pub fn get_unzoomed_transit_riders(
&self,
now: Time,
driving: &DrivingSimState,
map: &Map
) -> Vec<UnzoomedAgent>
[src]
&self,
now: Time,
driving: &DrivingSimState,
map: &Map
) -> Vec<UnzoomedAgent>
Trait Implementations
impl Clone for TransitSimState
[src]
impl Clone for TransitSimState
[src]fn clone(&self) -> TransitSimState
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl<'de> Deserialize<'de> for TransitSimState
[src]
impl<'de> Deserialize<'de> for TransitSimState
[src]fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error> where
__D: Deserializer<'de>,
[src]
__D: Deserializer<'de>,
impl Serialize for TransitSimState
[src]
impl Serialize for TransitSimState
[src]Auto Trait Implementations
impl RefUnwindSafe for TransitSimState
impl Send for TransitSimState
impl Sync for TransitSimState
impl Unpin for TransitSimState
impl UnwindSafe for TransitSimState
Blanket Implementations
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
impl<T> Instrument 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> Same<T> for T
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
pub fn vzip(self) -> V
impl<T> DeserializeOwned for T where
T: for<'de> Deserialize<'de>,
[src]
T: for<'de> Deserialize<'de>,