Create a Seasons enum
This commit is contained in:
parent
08cb444e7d
commit
e24e199e9e
19
src/main.rs
19
src/main.rs
@ -1,5 +1,6 @@
|
|||||||
extern crate smithay_client_toolkit as sctk;
|
extern crate smithay_client_toolkit as sctk;
|
||||||
|
|
||||||
|
use std::fmt;
|
||||||
use std::time::SystemTime;
|
use std::time::SystemTime;
|
||||||
|
|
||||||
use chrono::prelude::Local;
|
use chrono::prelude::Local;
|
||||||
@ -23,6 +24,24 @@ const HOUR_NAMES: [&str; 24] = [
|
|||||||
"Mushroom", "Thunder", "Frost", "Lantern",
|
"Mushroom", "Thunder", "Frost", "Lantern",
|
||||||
];
|
];
|
||||||
|
|
||||||
|
enum Season {
|
||||||
|
Spring,
|
||||||
|
Summer,
|
||||||
|
Autumn,
|
||||||
|
Winter,
|
||||||
|
}
|
||||||
|
|
||||||
|
impl fmt::Display for Season {
|
||||||
|
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
|
||||||
|
write!(f, "{}", match self {
|
||||||
|
Season::Spring => "spring",
|
||||||
|
Season::Summer => "summer",
|
||||||
|
Season::Autumn => "autumn",
|
||||||
|
Season::Winter => "winter",
|
||||||
|
})
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
fn seconds_to_degrees(seconds: i32) -> f32 {
|
fn seconds_to_degrees(seconds: i32) -> f32 {
|
||||||
seconds as f32 * 360.0 / 86400.0
|
seconds as f32 * 360.0 / 86400.0
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user