pub struct CurrentWeather { current_weather: serde_json::Value, clean: bool, } impl CurrentWeather { pub fn new(current_weather: serde_json::Value, clean: bool) -> CurrentWeather { CurrentWeather { current_weather, clean, } } pub fn extract_data(&self, data_name: &str, data_description: &str) -> String { let data = &self.current_weather[data_name]; if self.clean { format!("{data}") } else { format!("{data_description}: {data}") } } }