Adding SpeedUnit and TempUnit
This commit is contained in:
1 parent
09df3cc6ed
commit
cd04da0d91
9 files changed
+184
-46
No files matched your search
@@ -0,0 +1,24 @@
|
||||
use structopt::clap::arg_enum;
|
||||
|
||||
arg_enum! {
|
||||
|
||||
#[derive(Debug)]
|
||||
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(),
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user