Struct Train

Source
pub struct Train {
Show 24 fields pub route_name: String, pub train_num: String, pub train_id: String, pub lat: f64, pub lon: f64, pub train_timely: String, pub stations: Vec<TrainStation>, pub heading: Heading, pub event_code: String, pub event_tz: Option<String>, pub event_name: Option<String>, pub origin_code: String, pub origin_tz: String, pub origin_name: String, pub destination_code: String, pub destination_tz: String, pub destination_name: String, pub train_state: TrainState, pub velocity: f32, pub status_message: String, pub created_at: DateTime<FixedOffset>, pub updated_at: DateTime<FixedOffset>, pub last_value: DateTime<FixedOffset>, pub object_id: u32,
}
Expand description

Represents an Amtrak train

Fields§

§route_name: String

The human readable route name of this train.

§Examples:

  • “Keystone” (for the Keystone Corridor)
  • “Northeast Regional” (for the Northeast Corridor)
§train_num: String

The (possible unique) number identifying the train.

§train_id: String

The concatenation of the train_num with another number (not sure what exactly) in the format “{:train_num}-{:instance}”.

§Examples:

  • 6-4
  • 93-4
§lat: f64

The current latitude of the train

§lon: f64

The current longitude of the train

§train_timely: String

The human readable status of the timelyness of the train.

§Examples:

  • X Minutes Early
  • X Hours, Y Minutes Early
  • X Minutes Late
  • X Hours, Y Minutes Late
  • On Time
  • Unknown
  • NaN Minutes Early (yes really)
§stations: Vec<TrainStation>

List of stations that the train will visit. The stations are listed in the same order the train will stop at each.

§heading: Heading

The current compass heading of the train.

§event_code: String

Unsure of what this field symbolizes.

§event_tz: Option<String>

Unsure of what this field symbolizes.

§event_name: Option<String>

Unsure of what this field symbolizes.

§origin_code: String

The station code where the train originated from (aka the first station in this train’s route).

§Examples:

  • PHL
  • NYP
§origin_tz: String

The timezone of the original station

§Examples:

  • America/New_York
  • America/Chicago
§origin_name: String

The full human readable name of the station where the train originated from (aka the first station in this train’s route).

§Examples:

  • Philadelphia 30th Street
  • New York Penn
§destination_code: String

The station code where the train is heading to (aka the final destination of the train).

§Examples:

  • PHL
  • NYP
§destination_tz: String

The timezone of destination station

§Examples:

  • America/New_York
  • America/Chicago
§destination_name: String

The full human readable name of the station where the train is heading (aka the final destination of the train).

§Examples:

  • Philadelphia 30th Street
  • New York Penn
§train_state: TrainState

The current state of the train

§velocity: f32

The current velocity (in mph) of the train

§status_message: String

A human readable status message.

§Examples:

  • (Empty string, single whitespace)
  • SERVICE DISRUPTION
§created_at: DateTime<FixedOffset>

The time at which this train entry was created. The entry will have the local timezone as a fixed offset.

§Examples:

  • 2023-09-04T07:46:06-04:00
  • 2023-09-04T07:00:00-05:00
§updated_at: DateTime<FixedOffset>

The time at which this train entry was last updated. The entry will have the local timezone as a fixed offset.

§Examples:

  • 2023-09-04T07:46:06-04:00
  • 2023-09-04T07:00:00-05:00
§last_value: DateTime<FixedOffset>

Unsure of what this field symbolizes.

§object_id: u32

Unsure of what this field symbolizes.

Trait Implementations§

Source§

impl Clone for Train

Source§

fn clone(&self) -> Train

Returns a duplicate 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 Train

Source§

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

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

impl<'de> Deserialize<'de> for Train

Source§

fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>
where __D: Deserializer<'de>,

Deserialize this value from the given Serde deserializer. Read more

Auto Trait Implementations§

§

impl Freeze for Train

§

impl RefUnwindSafe for Train

§

impl Send for Train

§

impl Sync for Train

§

impl Unpin for Train

§

impl UnwindSafe for Train

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

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T> Instrument for T

Source§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
Source§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
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> PolicyExt for T
where T: ?Sized,

Source§

fn and<P, B, E>(self, other: P) -> And<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow only if self and other return Action::Follow. Read more
Source§

fn or<P, B, E>(self, other: P) -> Or<T, P>
where T: Policy<B, E>, P: Policy<B, E>,

Create a new Policy that returns Action::Follow if either self or other returns Action::Follow. Read more
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

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

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.
Source§

impl<T> WithSubscriber for T

Source§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,

Source§

impl<T> ErasedDestructor for T
where T: 'static,