Struct openrailwaymap_exporter::railway_objects::Train
source · 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 GeoLocation for Train
impl GeoLocation for Train
Implements the GeoLocation
trait for the Train
struct.
source§fn geo_location(&self) -> Option<Coord<f64>>
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>>)
fn set_geo_location(&mut self, location: Option<Coord<f64>>)
Sets the geographical location of the railway object
source§impl Movable for Train
impl Movable for Train
source§fn set_max_speed(&mut self, max_speed: Velocity)
fn set_max_speed(&mut self, max_speed: Velocity)
Sets the max speed of the object as a Velocity.
source§fn acceleration(&self) -> Acceleration
fn acceleration(&self) -> Acceleration
Returns the current acceleration of the object as an Acceleration.
source§fn set_acceleration(&mut self, acceleration: Acceleration)
fn set_acceleration(&mut self, acceleration: Acceleration)
Sets the acceleration of the object as an Acceleration.
source§impl MultipleTargets for Train
impl MultipleTargets for Train
Implements the MultipleTargets
trait for the Train
struct.
source§fn add_target(&mut self, target: NodeId)
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>
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
impl NextTarget for Train
Implements the NextTarget
trait for the Train
struct.
source§fn next_target(&self) -> Option<NodeId>
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>)
fn set_next_target(&mut self, target: Option<NodeId>)
Sets the next target of the railway object.
source§impl PartialEq<Train> for Train
impl PartialEq<Train> for Train
source§impl RailwayObject for Train
impl RailwayObject for Train
Implements the RailwayObject
trait for the Train
struct.
source§fn id(&self) -> RailwayObjectId
fn id(&self) -> RailwayObjectId
Returns the unique identifier of the railway object. Read more
source§fn position(&self) -> Option<NodeId>
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>)
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_mut(&mut self) -> &mut dyn Any
fn as_any_mut(&mut self) -> &mut dyn Any
Returns a mutable reference to the
Any
trait for this object. Read moreimpl 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§
§impl<T, U> AsBindGroupShaderType<U> for Twhere
U: ShaderType,
&'a T: for<'a> Into<U>,
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
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere T: Any,
§fn into_any(self: Box<T, Global>) -> Box<dyn Any + 'static, Global>
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>
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)
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)
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> FromWorld for Twhere
T: Default,
impl<T> FromWorld for Twhere T: Default,
§fn from_world(_world: &mut World) -> T
fn from_world(_world: &mut World) -> T
Creates
Self
using data from the given [World]source§impl<T> Instrument for T
impl<T> Instrument for T
source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> IntoPropValue<Option<T>> for T
impl<T> IntoPropValue<Option<T>> for T
§fn into_prop_value(self) -> Option<T>
fn into_prop_value(self) -> Option<T>
Convert
self
to a value of a Properties
struct.§impl<T> IntoPropValue<T> for T
impl<T> IntoPropValue<T> for T
§fn into_prop_value(self) -> T
fn into_prop_value(self) -> T
Convert
self
to a value of a Properties
struct.