Struct gtfs_rt::VehiclePosition
source · pub struct VehiclePosition {
pub trip: Option<TripDescriptor>,
pub vehicle: Option<VehicleDescriptor>,
pub position: Option<Position>,
pub current_stop_sequence: Option<u32>,
pub stop_id: Option<String>,
pub current_status: Option<i32>,
pub timestamp: Option<u64>,
pub congestion_level: Option<i32>,
pub occupancy_status: Option<i32>,
pub occupancy_percentage: Option<u32>,
pub multi_carriage_details: Vec<CarriageDetails>,
}
Expand description
Realtime positioning information for a given vehicle.
Fields§
§trip: Option<TripDescriptor>
The Trip that this vehicle is serving. Can be empty or partial if the vehicle can not be identified with a given trip instance.
vehicle: Option<VehicleDescriptor>
Additional information on the vehicle that is serving this trip.
position: Option<Position>
Current position of this vehicle.
current_stop_sequence: Option<u32>
The stop sequence index of the current stop. The meaning of current_stop_sequence (i.e., the stop that it refers to) is determined by current_status. If current_status is missing IN_TRANSIT_TO is assumed.
stop_id: Option<String>
Identifies the current stop. The value must be the same as in stops.txt in the corresponding GTFS feed.
current_status: Option<i32>
The exact status of the vehicle with respect to the current stop. Ignored if current_stop_sequence is missing.
timestamp: Option<u64>
Moment at which the vehicle’s position was measured. In POSIX time (i.e., number of seconds since January 1st 1970 00:00:00 UTC).
congestion_level: Option<i32>
§occupancy_status: Option<i32>
If multi_carriage_status is populated with per-carriage OccupancyStatus, then this field should describe the entire vehicle with all carriages accepting passengers considered.
occupancy_percentage: Option<u32>
A percentage value indicating the degree of passenger occupancy in the vehicle. The values are represented as an integer without decimals. 0 means 0% and 100 means 100%. The value 100 should represent the total maximum occupancy the vehicle was designed for, including both seated and standing capacity, and current operating regulations allow. The value may exceed 100 if there are more passengers than the maximum designed capacity. The precision of occupancy_percentage should be low enough that individual passengers cannot be tracked boarding or alighting the vehicle. If multi_carriage_status is populated with per-carriage occupancy_percentage, then this field should describe the entire vehicle with all carriages accepting passengers considered. This field is still experimental, and subject to change. It may be formally adopted in the future.
multi_carriage_details: Vec<CarriageDetails>
Details of the multiple carriages of this given vehicle. The first occurrence represents the first carriage of the vehicle, given the current direction of travel. The number of occurrences of the multi_carriage_details field represents the number of carriages of the vehicle. It also includes non boardable carriages, like engines, maintenance carriages, etc… as they provide valuable information to passengers about where to stand on a platform. This message/field is still experimental, and subject to change. It may be formally adopted in the future.
Implementations§
source§impl VehiclePosition
impl VehiclePosition
sourcepub fn current_stop_sequence(&self) -> u32
pub fn current_stop_sequence(&self) -> u32
Returns the value of current_stop_sequence
, or the default value if current_stop_sequence
is unset.
sourcepub fn current_status(&self) -> VehicleStopStatus
pub fn current_status(&self) -> VehicleStopStatus
Returns the enum value of current_status
, or the default if the field is unset or set to an invalid enum value.
sourcepub fn set_current_status(&mut self, value: VehicleStopStatus)
pub fn set_current_status(&mut self, value: VehicleStopStatus)
Sets current_status
to the provided enum value.
sourcepub fn timestamp(&self) -> u64
pub fn timestamp(&self) -> u64
Returns the value of timestamp
, or the default value if timestamp
is unset.
sourcepub fn congestion_level(&self) -> CongestionLevel
pub fn congestion_level(&self) -> CongestionLevel
Returns the enum value of congestion_level
, or the default if the field is unset or set to an invalid enum value.
sourcepub fn set_congestion_level(&mut self, value: CongestionLevel)
pub fn set_congestion_level(&mut self, value: CongestionLevel)
Sets congestion_level
to the provided enum value.
sourcepub fn stop_id(&self) -> &str
pub fn stop_id(&self) -> &str
Returns the value of stop_id
, or the default value if stop_id
is unset.
sourcepub fn occupancy_status(&self) -> OccupancyStatus
pub fn occupancy_status(&self) -> OccupancyStatus
Returns the enum value of occupancy_status
, or the default if the field is unset or set to an invalid enum value.
sourcepub fn set_occupancy_status(&mut self, value: OccupancyStatus)
pub fn set_occupancy_status(&mut self, value: OccupancyStatus)
Sets occupancy_status
to the provided enum value.
sourcepub fn occupancy_percentage(&self) -> u32
pub fn occupancy_percentage(&self) -> u32
Returns the value of occupancy_percentage
, or the default value if occupancy_percentage
is unset.
Trait Implementations§
source§impl Clone for VehiclePosition
impl Clone for VehiclePosition
source§fn clone(&self) -> VehiclePosition
fn clone(&self) -> VehiclePosition
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moresource§impl Debug for VehiclePosition
impl Debug for VehiclePosition
source§impl Default for VehiclePosition
impl Default for VehiclePosition
source§impl Message for VehiclePosition
impl Message for VehiclePosition
source§fn encoded_len(&self) -> usize
fn encoded_len(&self) -> usize
source§fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
source§fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
fn encode_length_delimited_to_vec(&self) -> Vec<u8>where
Self: Sized,
source§fn decode<B>(buf: B) -> Result<Self, DecodeError>
fn decode<B>(buf: B) -> Result<Self, DecodeError>
source§fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
source§fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
. Read moresource§fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
self
.source§impl PartialEq for VehiclePosition
impl PartialEq for VehiclePosition
source§fn eq(&self, other: &VehiclePosition) -> bool
fn eq(&self, other: &VehiclePosition) -> bool
self
and other
values to be equal, and is used
by ==
.