Moved GTFS struct back to structs, refresh works now.

This commit is contained in:
2026-05-02 08:16:13 +01:00
parent 4d272c31c5
commit ca0003edfd
4 changed files with 38 additions and 31 deletions
+25 -3
View File
@@ -1,6 +1,7 @@
use std::collections::{HashSet};
use std::collections::{HashMap, HashSet};
use gtfs_structures::{Route, Stop};
use chrono::NaiveTime;
use gtfs_structures::{Agency, Calendar, CalendarDate, RawStopTime, RawTrip, Route, Stop};
// This is to store the preferences for the GTFS(-R) side of the code.
pub struct Preferences {
@@ -8,10 +9,31 @@ pub struct Preferences {
pub stop_codes: HashSet<String>,
}
// The main GTFS struct. This is similar to (but not exactly) gtfs-structures::Gtfs because we don't need everything
#[derive(Debug)]
pub struct Gtfs {
/// All agencies. They can not be read by `agency_id`, as it is not a required field
pub agencies: Vec<Agency>,
/// All Calendar by `service_id`
pub calendar: HashMap<String, Calendar>,
/// All calendar dates grouped by service_id
pub calendar_dates: HashMap<String, Vec<CalendarDate>>,
/// All routes by `route_id`
pub routes: HashMap<String, Route>,
/// All stop by `stop_id`.
pub stops: HashMap<String, Stop>,
/// All trips by trip_id
pub trips: HashMap<String, RawTrip>,
/// Stop times for the chosen stops and the chosen routes
pub stop_times: HashMap<(String, u32), RawStopTime>,
}
#[derive(Debug)]
pub struct Arrival<'a> {
pub route: &'a Route,
pub stop: &'a Stop,
pub departure_time: u32,
pub departure_time: NaiveTime,
}