StopTime structs are not meaningful individually but only when they're grouped by trip. The stop_times.txt file is also not guaranteed to be sorted. It is very useful to have a helper that does this automatically.
I propose a struct Run and a supporting iterator whose constructor groups and sorts the stoptimes for you:
#[derive(Debug, PartialEq)]
pub struct Run
{
pub trip: &Trip, // or just trip_id String
// StopTime is verbose, maybe create a new struct with less fields?
pub sequence: Vec<StopTime>
}
StopTime structs are not meaningful individually but only when they're grouped by trip. The
stop_times.txt
file is also not guaranteed to be sorted. It is very useful to have a helper that does this automatically.I propose a struct Run and a supporting iterator whose constructor groups and sorts the stoptimes for you: