[][src]Struct sim::trips::TripManager

pub struct TripManager {
    trips: Vec<Trip>,
    people: Vec<Person>,
    active_trip_mode: BTreeMap<AgentID, TripID>,
    unfinished_trips: usize,
    pub pathfinding_upfront: bool,
    car_id_counter: usize,
    events: Vec<Event>,
}

Manages people, each of which executes some trips through the day. Each trip is further broken down into legs -- for example, a driving trip might start with somebody walking to their car, driving somewhere, parking, and then walking to their final destination. https://dabreegster.github.io/abstreet/trafficsim/trips.html describes some of the variations.

Fields

trips: Vec<Trip>people: Vec<Person>active_trip_mode: BTreeMap<AgentID, TripID>unfinished_trips: usizepathfinding_upfront: boolcar_id_counter: usizeevents: Vec<Event>

Implementations

impl TripManager[src]

pub fn new(pathfinding_upfront: bool) -> TripManager[src]

pub fn new_person(
    &mut self,
    id: PersonID,
    orig_id: Option<OrigPersonID>,
    ped_speed: Speed,
    vehicle_specs: Vec<VehicleSpec>
)
[src]

pub fn random_person(
    &mut self,
    ped_speed: Speed,
    vehicle_specs: Vec<VehicleSpec>
) -> &Person
[src]

pub fn new_car_id(&mut self) -> usize[src]

pub fn new_trip(
    &mut self,
    person: PersonID,
    departure: Time,
    start: TripEndpoint,
    mode: TripMode,
    purpose: TripPurpose,
    modified: bool,
    legs: Vec<TripLeg>,
    map: &Map
) -> TripID
[src]

pub fn agent_starting_trip_leg(&mut self, agent: AgentID, t: TripID)[src]

pub fn car_reached_parking_spot(
    &mut self,
    now: Time,
    car: CarID,
    spot: ParkingSpot,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_parking_spot(
    &mut self,
    now: Time,
    ped: PedestrianID,
    spot: ParkingSpot,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_ready_to_bike(
    &mut self,
    now: Time,
    ped: PedestrianID,
    spot: SidewalkSpot,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn bike_reached_end(
    &mut self,
    now: Time,
    bike: CarID,
    bike_rack: SidewalkSpot,
    blocked_time: Duration,
    map: &Map,
    scheduler: &mut Scheduler
)
[src]

pub fn ped_reached_building(
    &mut self,
    now: Time,
    ped: PedestrianID,
    bldg: BuildingID,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_bus_stop(
    &mut self,
    now: Time,
    ped: PedestrianID,
    stop: BusStopID,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>,
    transit: &mut TransitSimState
) -> Option<BusRouteID>
[src]

If no route is returned, the pedestrian boarded a bus immediately.

pub fn ped_boarded_bus(
    &mut self,
    now: Time,
    ped: PedestrianID,
    bus: CarID,
    blocked_time: Duration,
    walking: &mut WalkingSimState
) -> (TripID, PersonID)
[src]

pub fn person_left_bus(
    &mut self,
    now: Time,
    person: PersonID,
    bus: CarID,
    ctx: &mut Ctx<'_>
)
[src]

pub fn ped_reached_border(
    &mut self,
    now: Time,
    ped: PedestrianID,
    i: IntersectionID,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn transit_rider_reached_border(
    &mut self,
    now: Time,
    person: PersonID,
    bus: CarID,
    ctx: &mut Ctx<'_>
)
[src]

pub fn car_or_bike_reached_border(
    &mut self,
    now: Time,
    car: CarID,
    i: IntersectionID,
    blocked_time: Duration,
    ctx: &mut Ctx<'_>
)
[src]

pub fn remote_trip_finished(&mut self, now: Time, id: TripID, ctx: &mut Ctx<'_>)[src]

pub fn cancel_unstarted_trip(&mut self, id: TripID, reason: String)[src]

Cancel a trip before it's started. The person will stay where they are.

pub fn cancel_trip(
    &mut self,
    now: Time,
    id: TripID,
    reason: String,
    abandoned_vehicle: Option<Vehicle>,
    ctx: &mut Ctx<'_>
)
[src]

Cancel a trip after it's started. The person will be magically warped to their destination, along with their car, as if the trip had completed normally.

pub fn active_agents(&self) -> Vec<AgentID>[src]

pub fn get_active_trips(&self) -> Vec<TripID>[src]

pub fn active_agents_and_trips(&self) -> &BTreeMap<AgentID, TripID>[src]

pub fn num_active_agents(&self) -> usize[src]

pub fn trip_to_agent(&self, id: TripID) -> TripResult<AgentID>[src]

pub fn agent_to_trip(&self, id: AgentID) -> Option<TripID>[src]

This will be None for parked cars and buses. Should always work for pedestrians.

pub fn debug_trip(&self, id: AgentID)[src]

pub fn num_trips(&self) -> (usize, usize)[src]

pub fn num_agents(&self, transit: &TransitSimState) -> Counter<AgentType>[src]

pub fn num_ppl(&self) -> (usize, usize, usize)[src]

pub fn is_done(&self) -> bool[src]

pub fn collect_events(&mut self) -> Vec<Event>[src]

pub fn trip_info(&self, id: TripID) -> TripInfo[src]

pub fn all_trip_info(&self) -> Vec<(TripID, TripInfo)>[src]

pub fn finished_trip_time(&self, id: TripID) -> Option<(Duration, Duration)>[src]

pub fn bldg_to_people(&self, b: BuildingID) -> Vec<PersonID>[src]

pub fn get_person(&self, p: PersonID) -> Option<&Person>[src]

pub fn get_all_people(&self) -> &Vec<Person>[src]

pub fn trip_to_person(&self, id: TripID) -> PersonID[src]

fn person_finished_trip(
    &mut self,
    now: Time,
    person: PersonID,
    ctx: &mut Ctx<'_>
)
[src]

pub fn start_trip(
    &mut self,
    now: Time,
    trip: TripID,
    spec: TripSpec,
    maybe_req: Option<PathRequest>,
    maybe_path: Option<Path>,
    ctx: &mut Ctx<'_>
)
[src]

pub fn all_arrivals_at_border(
    &self,
    at: IntersectionID
) -> Vec<(Time, AgentType)>
[src]

pub fn generate_scenario(&self, map: &Map, name: String) -> Scenario[src]

Trait Implementations

impl Clone for TripManager[src]

impl Debug for TripManager[src]

impl<'de> Deserialize<'de> for TripManager[src]

impl Serialize for TripManager[src]

Auto Trait Implementations

impl RefUnwindSafe for TripManager

impl Send for TripManager

impl Sync for TripManager

impl Unpin for TripManager

impl UnwindSafe for TripManager

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> 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>,