Struct sim::trips::TripManager [−][src]
pub(crate) struct TripManager {
trips: Vec<Trip>,
people: Vec<Person>,
active_trip_mode: BTreeMap<AgentID, TripID>,
unfinished_trips: usize,
car_id_counter: usize,
events: Vec<Event>,
}
Expand description
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://a-b-street.github.io/tech/docs/trafficsim/trips.html describes some of the variations.
Fields
trips: Vec<Trip>
people: Vec<Person>
active_trip_mode: BTreeMap<AgentID, TripID>
unfinished_trips: usize
car_id_counter: usize
events: Vec<Event>
Implementations
pub fn new_person(
&mut self,
orig_id: Option<OrigPersonID>,
ped_speed: Speed,
vehicle_specs: Vec<VehicleSpec>
) -> &Person
This is idempotent to handle the case of cars retrying their spawning.
pub fn car_reached_parking_spot(
&mut self,
now: Time,
car: CarID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_parking_spot(
&mut self,
now: Time,
ped: PedestrianID,
spot: ParkingSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_ready_to_bike(
&mut self,
now: Time,
ped: PedestrianID,
spot: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn bike_reached_end(
&mut self,
now: Time,
bike: CarID,
bike_rack: SidewalkSpot,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_building(
&mut self,
now: Time,
ped: PedestrianID,
bldg: BuildingID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn ped_reached_bus_stop(
&mut self,
now: Time,
ped: PedestrianID,
stop: TransitStopID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>,
transit: &mut TransitSimState
) -> Option<TransitRouteID>
pub fn ped_reached_bus_stop(
&mut self,
now: Time,
ped: PedestrianID,
stop: TransitStopID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>,
transit: &mut TransitSimState
) -> Option<TransitRouteID>
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)
pub fn ped_reached_border(
&mut self,
now: Time,
ped: PedestrianID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
pub fn transit_rider_reached_border(
&mut self,
now: Time,
person: PersonID,
bus: CarID,
ctx: &mut Ctx<'_>
)
pub fn car_or_bike_reached_border(
&mut self,
now: Time,
car: CarID,
i: IntersectionID,
blocked_time: Duration,
distance_crossed: Distance,
ctx: &mut Ctx<'_>
)
Cancel a trip before it’s started. The person will stay where they are.
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.
This will be None for parked cars and buses. Should always work for pedestrians.
pub fn num_commuters_vehicles(
&self,
transit: &TransitSimState,
walking: &WalkingSimState
) -> CommutersVehiclesCounts
Recreate the Scenario from an instantiated simulation. The results should match the original Scenario used.
Trait Implementations
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 RefUnwindSafe for TripManager
impl Send for TripManager
impl Sync for TripManager
impl Unpin for TripManager
impl UnwindSafe for TripManager
Blanket Implementations
Mutably borrows from an owned value. Read more
impl<T> Downcast for T where
T: Any,
impl<T> Downcast for T where
T: Any,
Convert Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
. Read more
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
pub fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>
Convert Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
. Read more
Convert &Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s. Read more
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
pub fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert &mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s. Read more
Instruments this type with the provided Span
, returning an
Instrumented
wrapper. Read more
type Output = T
type Output = T
Should always be Self