1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
#[derive(serde::Deserialize, Clone)] pub struct Settings { pub server: Option<String>, pub enable: Option<bool>, } impl Settings { pub fn enabled(&self) -> bool { if let Some(mode) = &self.enable { *mode } else { true } } }