gistools/readers/gtfs/schedule/
location_group_stops.rs

1use crate::readers::csv::parse_csv_as_record;
2use alloc::{string::String, vec::Vec};
3use s2json::MValueCompatible;
4
5/// # Location Group Stops
6///
7/// **Optional**
8/// Assigns stops from `stops.txt` to location groups (`location_groups.txt`).
9#[derive(Debug, Default, Clone, PartialEq, MValueCompatible)]
10pub struct GTFSLocationGroupStop {
11    /// **Required**
12    /// Identifies a location group (`location_groups.location_group_id`).
13    pub location_group_id: String,
14    /// **Required**
15    /// Identifies a stop (`stops.stop_id`) belonging to that location group.
16    pub stop_id: String,
17}
18impl GTFSLocationGroupStop {
19    /// Create a new GTFSLocationGroupStop
20    pub fn new(source: &str) -> Vec<GTFSLocationGroupStop> {
21        let mut res = Vec::new();
22        for record in parse_csv_as_record::<GTFSLocationGroupStop>(source, None, None) {
23            res.push(record);
24        }
25        res
26    }
27}