Struct GtfsGenerator

Source
pub struct GtfsGenerator { /* private fields */ }
Expand description

Incomplete GTFS feed

Implementations§

Source§

impl GtfsGenerator

Source

pub fn new() -> GtfsGenerator

Create a new GTFS generator

Source

pub fn add_agency(&mut self, agency: Agency) -> Result<()>

Add an agency

See https://gtfs.org/schedule/reference/#agencytxt for rules of the individual fields

Note: This crate requires agency IDs to be set, even if there’s only a single agency.

Source

pub fn add_stop(&mut self, stop: Stop) -> Result<()>

Add a stop

See https://gtfs.org/schedule/reference/#stopstxt for rules of the individual fields

Source

pub fn add_route(&mut self, route: Route) -> Result<()>

Add a route

See https://gtfs.org/schedule/reference/#routestxt for rules of the individual fields

Note: This crate requires agency IDs to be set, even if there’s only a single agency.

Source

pub fn add_trip(&mut self, trip: RawTrip) -> Result<()>

Add a trip

See https://gtfs.org/schedule/reference/#tripstxt for rules of the individual fields

Note: All entries that the trip refers to already need to exist

Source

pub fn add_stop_time(&mut self, stop_time: RawStopTime) -> Result<()>

Add a stop time

See https://gtfs.org/schedule/reference/#stoptimestxt for rules of the individual fields

Note: All entries that the trip refers to already need to exist

Source

pub fn add_service(&mut self, calendar: Calendar) -> Result<()>

Add a calendar entry

See https://gtfs.org/schedule/reference/#calendartxt for rules of the individual fields

Source

pub fn set_feed_info(&mut self, feed_info: FeedInfo) -> Result<()>

Set the feed info metadata

See https://gtfs.org/schedule/reference/#feedinfotxt for rules of the individual fields

Source

pub fn write_to<T: AsRef<Path>>(self, path: T) -> Result<()>

Write the resulting feed to a ZIP file

Before writing, all fields that can be set automatically are set. Currently that is:

  • feed_start_date (Set to the first service day in the calendar)
  • feed_end_date (Set to the last service day in the calendar)

If the assumptions to not match for your purpose, for example because you include days in the calendar for which the schedule is not yet certain, please set the fields to the correct value before writing.

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> Same for T

Source§

type Output = T

Should always be Self
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.