Skip to main content

LayeredObserver

Trait LayeredObserver 

Source
pub trait LayeredObserver {
    // Required method
    fn observe(&mut self, index: usize, ped: &Pedestrian3D);
}
Expand description

Per-pedestrian post-step observation hook for the layered 2.5-D drive.

Mirrors crate::integration::CrowdObserver for the 2-D AgentStore path: closes the layered half of the P1-6 “telemetry hooks” item from docs/rustsim-crowd.md. Invoked by step_layered_scratch_observed after every tick stage has completed (rider advance, per-floor physics, boarding decisions), so the Pedestrian3D argument carries the authoritative post-tick floor, z_offset, transition, target_floor, and planar state. The index argument is the position of the pedestrian inside peds, which is stable across the call (the layered drive never reorders the slice).

The trait is blanket-implemented for every FnMut(usize, &Pedestrian3D), so callers typically pass a closure that forwards into a TelemetryPipeline, a per-floor occupancy counter, or a CSV logger — without rustsim-crowd itself taking a dependency on any sink implementation.

Observation order is 0..peds.len(), deterministic on every run.

Required Methods§

Source

fn observe(&mut self, index: usize, ped: &Pedestrian3D)

Observe the post-tick state of one pedestrian.

Implementors§