Crate gtfs_realtime

Source
Expand description

§Decoding and Encoding example GTFS data example

use prost::Message;
 
let url = "https://lbtgtfs.lbtransit.com/TMGTFSRealTimeWebService/Vehicle/VehiclePositions.pb";
let response = reqwest::get(url).await.unwrap();
let bytes = response.bytes().await.unwrap();
let data: Result<gtfs_realtime::FeedMessage, prost::DecodeError> = prost::Message::decode(bytes.as_ref());
let data = data.unwrap();
 
//encode back into protobuf
let rencoded = data.encode_to_vec();

Modules§

alert
Nested message and enum types in Alert.
feed_header
Nested message and enum types in FeedHeader.
stop
Nested message and enum types in Stop.
translated_image
Nested message and enum types in TranslatedImage.
translated_string
Nested message and enum types in TranslatedString.
trip_descriptor
Nested message and enum types in TripDescriptor.
trip_modifications
Nested message and enum types in TripModifications.
trip_update
Nested message and enum types in TripUpdate.
vehicle_descriptor
Nested message and enum types in VehicleDescriptor.
vehicle_position
Nested message and enum types in VehiclePosition.

Structs§

Alert
An alert, indicating some sort of incident in the public transit network.
EntitySelector
A selector for an entity in a GTFS feed.
FeedEntity
A definition (or update) of an entity in the transit feed.
FeedHeader
Metadata about a feed, included in feed messages.
FeedMessage
The contents of a feed message. A feed is a continuous stream of feed messages. Each message in the stream is obtained as a response to an appropriate HTTP GET request. A realtime feed is always defined with relation to an existing GTFS feed. All the entity ids are resolved with respect to the GTFS feed. Note that “required” and “optional” as stated in this file refer to Protocol Buffer cardinality, not semantic cardinality. See reference.md at https://github.com/google/transit/tree/master/gtfs-realtime for field semantic cardinality.
Position
A position.
ReplacementStop
NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
Shape
Describes the physical path that a vehicle takes when it’s not part of the (CSV) GTFS, such as for a detour. Shapes belong to Trips, and consist of a sequence of shape points. Tracing the points in order provides the path of the vehicle. Shapes do not need to intercept the location of Stops exactly, but all Stops on a trip should lie within a small distance of the shape for that trip, i.e. close to straight line segments connecting the shape points NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
Stop
Describes a stop which is served by trips. All fields are as described in the GTFS-Static specification. NOTE: This message is still experimental, and subject to change. It may be formally adopted in the future.
StopSelector
NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future. Select a stop by stop sequence or by stop_id. At least one of the two values must be provided.
TimeRange
A time interval. The interval is considered active at time ‘t’ if ‘t’ is greater than or equal to the start time and less than the end time.
TranslatedImage
An internationalized image containing per-language versions of a URL linking to an image along with meta information Only one of the images from a message will be retained by consumers. The resolution proceeds as follows:
TranslatedString
An internationalized message containing per-language versions of a snippet of text or a URL. One of the strings from a message will be picked up. The resolution proceeds as follows:
TripDescriptor
A descriptor that identifies an instance of a GTFS trip, or all instances of a trip along a route.
TripModifications
NOTE: This field is still experimental, and subject to change. It may be formally adopted in the future.
TripUpdate
Realtime update of the progress of a vehicle along a trip. Depending on the value of ScheduleRelationship, a TripUpdate can specify:
VehicleDescriptor
Identification information for the vehicle performing the trip.
VehiclePosition
Realtime positioning information for a given vehicle.