pub struct Train {
    pub id: i64,
    pub position: Option<NodeId>,
    pub geo_location: Option<Coord<f64>>,
    pub next_target: Option<NodeId>,
    pub targets: VecDeque<NodeId>,
    pub speed: Velocity,
    pub max_speed: Velocity,
    pub acceleration: Acceleration,
}
Expand description

A Train struct representing a train in the railway system.

Fields§

§id: i64

The unique identifier for the train.

§position: Option<NodeId>

The current position of the train, represented by a node ID.

§geo_location: Option<Coord<f64>>

The geographical location of the train, represented by a coordinate.

§next_target: Option<NodeId>

The next target node ID for the train to move towards.

§targets: VecDeque<NodeId>

A queue of target node IDs for the train to follow.

§speed: Velocity

The current speed of the train

§max_speed: Velocity

The current speed of the train

§acceleration: Acceleration

The current acceleration of the train

Trait Implementations§

source§

impl Clone for Train

source§

fn clone(&self) -> Train

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 Train

source§

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

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

impl Default for Train

source§

fn default() -> Train

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

impl GeoLocation for Train

Implements the GeoLocation trait for the Train struct.

source§

fn geo_location(&self) -> Option<Coord<f64>>

Returns the geographical location of the railway object as a coordinate.
source§

fn set_geo_location(&mut self, location: Option<Coord<f64>>)

Sets the geographical location of the railway object
source§

impl Movable for Train

source§

fn max_speed(&self) -> Velocity

Returns the max speed of the object as a Velocity.
source§

fn set_max_speed(&mut self, max_speed: Velocity)

Sets the max speed of the object as a Velocity.
source§

fn speed(&self) -> Velocity

Returns the current speed of the object as a Velocity.
source§

fn set_speed(&mut self, speed: Velocity)

Sets the speed of the object as a Velocity.
source§

fn acceleration(&self) -> Acceleration

Returns the current acceleration of the object as an Acceleration.
source§

fn set_acceleration(&mut self, acceleration: Acceleration)

Sets the acceleration of the object as an Acceleration.
source§

impl MultipleTargets for Train

Implements the MultipleTargets trait for the Train struct.

source§

fn targets(&self) -> &VecDeque<NodeId>

Returns the list of targets for the railway object.
source§

fn add_target(&mut self, target: NodeId)

Adds a target to the list of targets for the railway object.
source§

fn remove_target(&mut self) -> Option<NodeId>

Removes and returns the first target from the list of targets for the railway object, if any.
source§

impl NextTarget for Train

Implements the NextTarget trait for the Train struct.

source§

fn next_target(&self) -> Option<NodeId>

Returns the next target of the railway object, if any.
source§

fn set_next_target(&mut self, target: Option<NodeId>)

Sets the next target of the railway object.
source§

impl PartialEq<Train> for Train

source§

fn eq(&self, other: &Train) -> 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 RailwayObject for Train

Implements the RailwayObject trait for the Train struct.

source§

fn id(&self) -> RailwayObjectId

Returns the unique identifier of the railway object. Read more
source§

fn position(&self) -> Option<NodeId>

Returns the position of the railway object within the internal model. Read more
source§

fn set_position(&mut self, position: Option<NodeId>)

Sets the position of the railway object within the internal model. Read more
source§

fn as_any(&self) -> &dyn Any

Returns a reference to the Any trait for this object. Read more
source§

fn as_any_mut(&mut self) -> &mut dyn Any

Returns a mutable reference to the Any trait for this object. Read more
source§

impl StructuralPartialEq for Train

Auto Trait Implementations§

§

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 Twhere T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for Twhere U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U

Return the T [ShaderType] for self. When used in [AsBindGroup] derives, it is safe to assume that all images in self exist.
source§

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

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

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

source§

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

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for Twhere T: Any,

§

fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>

Convert Box<dyn Trait> (where Trait: Downcast) to Box<dyn Any>. Box<dyn Any> can then be further downcast into Box<ConcreteType> where ConcreteType implements Trait.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any + 'static>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
§

impl<T> DowncastSync for Twhere T: Any + Send + Sync,

§

fn into_any_arc(self: Arc<T>) -> Arc<dyn Any + Sync + Send + 'static>

Convert Arc<Trait> (where Trait: Downcast) to Arc<Any>. Arc<Any> can then be further downcast into Arc<ConcreteType> where ConcreteType implements Trait.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T> FromWorld for Twhere T: Default,

§

fn from_world(_world: &mut World) -> T

Creates Self using data from the given [World]
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 Twhere 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.

§

impl<T> IntoPropValue<Option<T>> for T

§

fn into_prop_value(self) -> Option<T>

Convert self to a value of a Properties struct.
§

impl<T> IntoPropValue<T> for T

§

fn into_prop_value(self) -> T

Convert self to a value of a Properties struct.
source§

impl<T> Same<T> for T

§

type Output = T

Should always be Self
source§

impl<T> ToOwned for Twhere 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 Twhere 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 Twhere 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.
§

impl<T> TypeData for Twhere T: 'static + Send + Sync + Clone,

§

fn clone_type_data(&self) -> Box<dyn TypeData + 'static, Global>

§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for Twhere V: MultiLane<T>,

§

fn vzip(self) -> V

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
§

impl<G1, G2> Within<G2> for G1where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool

§

impl<G1, G2> Within<G2> for G1where G2: Contains<G1>,

§

fn is_within(&self, b: &G2) -> bool

§

impl<T> HasAllProps<(), T> for T

§

impl<T> SerializableAny for Twhere T: 'static + Any + Clone + Send + Sync,

source§

impl<T> SimulationObject for Twhere T: RailwayObject + Movable + NextTarget + GeoLocation + Send + Sync,

§

impl<T> Ungil for Twhere T: Send,