use core::fmt; #[derive(Debug, Clone)] pub enum WallpaperHandler { Feh, Plasma, Gnome, Error, } impl WallpaperHandler { pub fn new(handler: String) -> WallpaperHandler { match handler.as_str() { "feh" => WallpaperHandler::Feh, "plasma" => WallpaperHandler::Plasma, "gnome" => WallpaperHandler::Gnome, _ => WallpaperHandler::Error, } } } impl fmt::Display for WallpaperHandler { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { write!(f, "{:?}", self) } } #[derive(Debug, Clone)] pub enum MonitorType { Ultrawide, Horizontal, Vertical, Error, } impl MonitorType { pub fn new(mon_type: String) -> MonitorType { match mon_type.as_str() { "ultrawide" => MonitorType::Ultrawide, "vertical" => MonitorType::Vertical, "horizontal" => MonitorType::Horizontal, _ => MonitorType::Error, } } } impl fmt::Display for MonitorType { fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { write!(f, "{:?}", self) } }