Enum sim::events::Event [−][src]
pub enum Event {
Show 20 variants
CarReachedParkingSpot(CarID, ParkingSpot),
CarLeftParkingSpot(CarID, ParkingSpot),
BusArrivedAtStop(CarID, TransitRouteID, TransitStopID),
BusDepartedFromStop(CarID, TransitRouteID, TransitStopID),
PassengerBoardsTransit(PersonID, CarID, TransitRouteID, TransitStopID, Duration),
PassengerAlightsTransit(PersonID, CarID, TransitRouteID, TransitStopID),
PersonEntersBuilding(PersonID, BuildingID),
PersonLeavesBuilding(PersonID, BuildingID),
PersonLeavesMap(PersonID, Option<AgentID>, IntersectionID),
PersonEntersMap(PersonID, AgentID, IntersectionID),
PedReachedParkingSpot(PedestrianID, ParkingSpot),
BikeStoppedAtSidewalk(CarID, LaneID),
ProblemEncountered(TripID, Problem),
AgentEntersTraversable(AgentID, Option<TripID>, Traversable, Option<usize>),
IntersectionDelayMeasured(TripID, TurnID, AgentID, Duration),
TripFinished {
trip: TripID,
mode: TripMode,
total_time: Duration,
blocked_time: Duration,
},
TripCancelled(TripID, TripMode),
TripPhaseStarting(TripID, PersonID, Option<PathRequest>, TripPhaseType),
PathAmended(Path),
Alert(AlertLocation, String),
}
Expand description
As a simulation runs, different systems emit Events. This cleanly separates the internal mechanics of the simulation from consumers that just want to know what’s happening.
An Event always occurs at a particular time, plumbed separately to consumers.
Many of these were created for a test framework that’s been abandoned. They could be removed or have their API adjusted, but it’s not urgent; publishing an event that’s not used by Analytics has no performance impact.
Variants
CarReachedParkingSpot(CarID, ParkingSpot)
Tuple Fields of CarReachedParkingSpot
0: CarID
1: ParkingSpot
CarLeftParkingSpot(CarID, ParkingSpot)
Tuple Fields of CarLeftParkingSpot
0: CarID
1: ParkingSpot
BusArrivedAtStop(CarID, TransitRouteID, TransitStopID)
Tuple Fields of BusArrivedAtStop
BusDepartedFromStop(CarID, TransitRouteID, TransitStopID)
Tuple Fields of BusDepartedFromStop
PassengerBoardsTransit(PersonID, CarID, TransitRouteID, TransitStopID, Duration)
How long waiting at the stop?
Tuple Fields of PassengerBoardsTransit
PassengerAlightsTransit(PersonID, CarID, TransitRouteID, TransitStopID)
Tuple Fields of PassengerAlightsTransit
PersonEntersBuilding(PersonID, BuildingID)
Tuple Fields of PersonEntersBuilding
0: PersonID
1: BuildingID
PersonLeavesBuilding(PersonID, BuildingID)
Tuple Fields of PersonLeavesBuilding
0: PersonID
1: BuildingID
PersonLeavesMap(PersonID, Option<AgentID>, IntersectionID)
None if cancelled
Tuple Fields of PersonLeavesMap
PersonEntersMap(PersonID, AgentID, IntersectionID)
Tuple Fields of PersonEntersMap
PedReachedParkingSpot(PedestrianID, ParkingSpot)
Tuple Fields of PedReachedParkingSpot
0: PedestrianID
1: ParkingSpot
If the agent is a transit vehicle, then include a count of how many passengers are on board.
TripID, TurnID (Where the delay was encountered), Time spent waiting at that turn
TripPhaseStarting(TripID, PersonID, Option<PathRequest>, TripPhaseType)
Tuple Fields of TripPhaseStarting
PathAmended(Path)
Just use for parking replanning. Not happy about copying the full path in here, but the way to plumb info into Analytics is Event.
Tuple Fields of PathAmended
0: Path
Alert(AlertLocation, String)
Tuple Fields of Alert
0: AlertLocation
1: String
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 Event
impl UnwindSafe for Event
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