Ordering some files

This commit is contained in:
2023-06-18 13:53:45 +02:00
parent 0c3a3126f8
commit fd4affdb17
14 changed files with 70 additions and 38 deletions
+12
View File
@@ -0,0 +1,12 @@
use serde::{Deserialize, Serialize};
use structopt::clap::arg_enum;
arg_enum! {
#[derive(Serialize, Deserialize, Debug, PartialEq, Clone, Copy)]
pub enum DataFormat {
Normal,
Clean,
JSON
}
}
+31
View File
@@ -0,0 +1,31 @@
use serde::{Deserialize, Serialize};
use structopt::clap::arg_enum;
arg_enum! {
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
pub enum SpeedUnit {
Kmh,
Ms,
Mph,
Knots
}
}
pub fn speed_to_unit_string(speed_unit: &SpeedUnit) -> String {
match speed_unit {
SpeedUnit::Kmh => "km/h".to_string(),
SpeedUnit::Ms => "m/s".to_string(),
SpeedUnit::Mph => "mp/h".to_string(),
SpeedUnit::Knots => "knots".to_string(),
}
}
pub fn speed_to_string(speed_unit: &SpeedUnit) -> String {
match speed_unit {
SpeedUnit::Kmh => "kmh".to_string(),
SpeedUnit::Ms => "ms".to_string(),
SpeedUnit::Mph => "mph".to_string(),
SpeedUnit::Knots => "kn".to_string(),
}
}
+25
View File
@@ -0,0 +1,25 @@
use serde::{Deserialize, Serialize};
use structopt::clap::arg_enum;
arg_enum! {
#[derive(Serialize, Deserialize, Debug, Clone, Copy)]
pub enum TempUnit {
Celsius,
Fahrenheit
}
}
pub fn temp_to_unit_string(temp_unit: &TempUnit) -> String {
match temp_unit {
TempUnit::Celsius => "°C".to_string(),
TempUnit::Fahrenheit => "°F".to_string(),
}
}
pub fn temp_to_string(temp_unit: &TempUnit) -> String {
match temp_unit {
TempUnit::Celsius => "celsius".to_string(),
TempUnit::Fahrenheit => "fahrenheit".to_string(),
}
}