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

source

pub fn current_stop_sequence(&self) -> u32

Returns the value of current_stop_sequence, or the default value if current_stop_sequence is unset.

source

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.

source

pub fn set_current_status(&mut self, value: VehicleStopStatus)

Sets current_status to the provided enum value.

source

pub fn timestamp(&self) -> u64

Returns the value of timestamp, or the default value if timestamp is unset.

source

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.

source

pub fn set_congestion_level(&mut self, value: CongestionLevel)

Sets congestion_level to the provided enum value.

source

pub fn stop_id(&self) -> &str

Returns the value of stop_id, or the default value if stop_id is unset.

source

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.

source

pub fn set_occupancy_status(&mut self, value: OccupancyStatus)

Sets occupancy_status to the provided enum value.

source

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

source§

fn clone(&self) -> VehiclePosition

Returns a copy of the value. Read more
1.0.0 · source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
source§

impl Debug for VehiclePosition

source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
source§

impl Default for VehiclePosition

source§

fn default() -> Self

Returns the “default value” for a type. Read more
source§

impl Message for VehiclePosition

source§

fn encoded_len(&self) -> usize

Returns the encoded length of the message without a length delimiter.
source§

fn clear(&mut self)

Clears the message, resetting all fields to their default.
source§

fn encode<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message to a buffer. Read more
source§

fn encode_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message to a newly allocated buffer.
source§

fn encode_length_delimited<B>(&self, buf: &mut B) -> Result<(), EncodeError>
where B: BufMut, Self: Sized,

Encodes the message with a length-delimiter to a buffer. Read more
source§

fn encode_length_delimited_to_vec(&self) -> Vec<u8>
where Self: Sized,

Encodes the message with a length-delimiter to a newly allocated buffer.
source§

fn decode<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes an instance of the message from a buffer. Read more
source§

fn decode_length_delimited<B>(buf: B) -> Result<Self, DecodeError>
where B: Buf, Self: Default,

Decodes a length-delimited instance of the message from the buffer.
source§

fn merge<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes an instance of the message from a buffer, and merges it into self. Read more
source§

fn merge_length_delimited<B>(&mut self, buf: B) -> Result<(), DecodeError>
where B: Buf, Self: Sized,

Decodes a length-delimited instance of the message from buffer, and merges it into self.
source§

impl PartialEq for VehiclePosition

source§

fn eq(&self, other: &VehiclePosition) -> bool

This method tests for self and other values to be equal, and is used by ==.
1.0.0 · source§

fn ne(&self, other: &Rhs) -> bool

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
source§

impl Serialize for VehiclePosition

source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
source§

impl StructuralPartialEq for VehiclePosition

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> ToOwned for T
where T: Clone,

§

type Owned = T

The resulting type after obtaining ownership.
source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
source§

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

§

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>,

§

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.