Struct gtfs_structures::RawGtfs
source · pub struct RawGtfs {Show 19 fields
pub read_duration: i64,
pub calendar: Option<Result<Vec<Calendar>, Error>>,
pub calendar_dates: Option<Result<Vec<CalendarDate>, Error>>,
pub stops: Result<Vec<Stop>, Error>,
pub routes: Result<Vec<Route>, Error>,
pub trips: Result<Vec<RawTrip>, Error>,
pub agencies: Result<Vec<Agency>, Error>,
pub shapes: Option<Result<Vec<Shape>, Error>>,
pub fare_attributes: Option<Result<Vec<FareAttribute>, Error>>,
pub fare_rules: Option<Result<Vec<FareRule>, Error>>,
pub frequencies: Option<Result<Vec<RawFrequency>, Error>>,
pub transfers: Option<Result<Vec<RawTransfer>, Error>>,
pub pathways: Option<Result<Vec<RawPathway>, Error>>,
pub feed_info: Option<Result<Vec<FeedInfo>, Error>>,
pub stop_times: Result<Vec<RawStopTime>, Error>,
pub files: Vec<String>,
pub source_format: SourceFormat,
pub sha256: Option<String>,
pub translations: Option<Result<Vec<RawTranslation>, Error>>,
}
Expand description
Data structure that map the GTFS csv with little intelligence
This is used to analyze the GTFS and detect anomalies To manipulate the transit data, maybe crate::Gtfs will be more convienient
Fields§
§read_duration: i64
Time needed to read and parse the archive in milliseconds
calendar: Option<Result<Vec<Calendar>, Error>>
All Calendar, None if the file was absent as it is not mandatory
calendar_dates: Option<Result<Vec<CalendarDate>, Error>>
All Calendar dates, None if the file was absent as it is not mandatory
stops: Result<Vec<Stop>, Error>
All Stops
routes: Result<Vec<Route>, Error>
All Routes
trips: Result<Vec<RawTrip>, Error>
All Trips
agencies: Result<Vec<Agency>, Error>
All Agencies
shapes: Option<Result<Vec<Shape>, Error>>
All shapes points, None if the file was absent as it is not mandatory
fare_attributes: Option<Result<Vec<FareAttribute>, Error>>
All FareAttribates, None if the file was absent as it is not mandatory
fare_rules: Option<Result<Vec<FareRule>, Error>>
All FareRules, None if the file was absent as it is not mandatory
frequencies: Option<Result<Vec<RawFrequency>, Error>>
All Frequencies, None if the file was absent as it is not mandatory
transfers: Option<Result<Vec<RawTransfer>, Error>>
All Transfers, None if the file was absent as it is not mandatory
pathways: Option<Result<Vec<RawPathway>, Error>>
All Pathways, None if the file was absent as it is not mandatory
feed_info: Option<Result<Vec<FeedInfo>, Error>>
All FeedInfo, None if the file was absent as it is not mandatory
stop_times: Result<Vec<RawStopTime>, Error>
All StopTimes
files: Vec<String>
All files that are present in the feed
source_format: SourceFormat
Format of the data read
sha256: Option<String>
sha256 sum of the feed
translations: Option<Result<Vec<RawTranslation>, Error>>
All translations, None if the file was absent as it is not mandatory
Implementations§
source§impl RawGtfs
impl RawGtfs
sourcepub fn print_stats(&self)
pub fn print_stats(&self)
Prints on stdout some basic statistics about the GTFS file (numbers of elements for each object). Mostly to be sure that everything was read
sourcepub fn new(gtfs: &str) -> Result<Self, Error>
pub fn new(gtfs: &str) -> Result<Self, Error>
Reads from an url (if starts with http), or a local path (either a directory or zipped file)
To read from an url, build with read-url feature See also RawGtfs::from_url and RawGtfs::from_path if you don’t want the library to guess
sourcepub fn from_path<P>(path: P) -> Result<Self, Error>
pub fn from_path<P>(path: P) -> Result<Self, Error>
Reads the raw GTFS from a local zip archive or local directory
sourcepub fn from_url<U: IntoUrl>(url: U) -> Result<Self, Error>
pub fn from_url<U: IntoUrl>(url: U) -> Result<Self, Error>
Reads the raw GTFS from a remote url
The library must be built with the read-url feature
sourcepub async fn from_url_async<U: IntoUrl>(url: U) -> Result<Self, Error>
pub async fn from_url_async<U: IntoUrl>(url: U) -> Result<Self, Error>
Non-blocking read the raw GTFS from a remote url
The library must be built with the read-url feature
sourcepub fn from_reader<T: Read + Seek>(reader: T) -> Result<Self, Error>
pub fn from_reader<T: Read + Seek>(reader: T) -> Result<Self, Error>
Reads for any object implementing std::io::Read and std::io::Seek
Mostly an internal function that abstracts reading from an url or local file