[][src]Struct sim::transit::TransitSimState

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]

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]

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]

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]

Trait Implementations

impl Clone for TransitSimState[src]

impl<'de> Deserialize<'de> 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> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[src]

impl<T> Downcast for T where
    T: Any

impl<T> DowncastSync for T where
    T: Send + Sync + Any

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,