diff --git a/src/level.rs b/src/level.rs index 1153391..03296e9 100644 --- a/src/level.rs +++ b/src/level.rs @@ -163,7 +163,8 @@ pub struct BlockUpdate { } /// weather types for a level -#[derive(Debug, Clone, Copy, Serialize, Deserialize)] +#[derive(Debug, Clone, Copy, Serialize, Deserialize, strum::EnumString, strum::IntoStaticStr)] +#[strum(ascii_case_insensitive)] pub enum WeatherType { Sunny, Raining, @@ -195,16 +196,3 @@ impl From for WeatherType { } } } - -impl TryFrom<&str> for WeatherType { - type Error = (); - - fn try_from(value: &str) -> Result { - Ok(match value { - "sunny" => Self::Sunny, - "raining" => Self::Raining, - "snowing" => Self::Snowing, - _ => return Err(()), - }) - } -}