pub enum SpeedArg {
Stop,
EmergencyStop,
Drive(u8),
}Expand description
Represents the speed set to a SlotArg.
Variants§
Stop
Performs a normal stop. Trains may stop smoothly when they receive a message force them to stop.
EmergencyStop
Performs an immediate stop action. Trains do stop immediately.
Drive(u8)
Sets the slots speed to a given value. If you want a slot speed to set to 0
use SpeedArg::Stop or create your SpeedArg using SpeedArg::new().
The maximum speed is 126. Higher values may create unexpected behaviour.
Implementations§
Source§impl SpeedArg
impl SpeedArg
Sourcepub fn new(spd: u8) -> Self
pub fn new(spd: u8) -> Self
Creates a new SpeedArg from the given value.
This means returning SpeedArg::Stop if the given spd is set to 0 and
returning SpeedArg::Drive with the given spd set as speed otherwise.
§Parameters
spd: The speed to create theSpeedArgfor. The maximum speed is 126. Higher values may create unexpected behaviour.
Sourcepub fn get_spd(&self) -> u8
pub fn get_spd(&self) -> u8
§Returns
A u8 interpreted value of the given SpeedArg.
Please note that SpeedArg::Stop and SpeedArg::EmergencyStop are both cast to 0
as they both indicates that the slots speed is 0 and only differ in how
immediate this state is reached by the connected device.