use std::str::FromStr; #[derive(Clone, Debug)] pub struct Configuration { pub time_mode: TimeMode, } #[derive(Clone, Debug)] pub enum TimeMode { CpuTime, WallTime, } impl FromStr for TimeMode { type Err = (); fn from_str(s: &str) -> Result { match s { "cpu" => Ok(Self::CpuTime), "wall" => Ok(Self::WallTime), _ => Err(()), } } }