diff options
author | Mustafa Salih <37256744+MustafaSalih1993@users.noreply.github.com> | 2021-01-22 00:53:11 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-01-22 00:53:11 +0300 |
commit | 9525a1075199d5fd202d1744dc502ff5a766aa99 (patch) | |
tree | 65ec9c5397bf7de009f3484ea161e77df2120f67 /src/utils/weather.rs | |
parent | e6f9ce2ed5da0eb833d548a613c3b70360c9f4b5 (diff) | |
parent | 861a986567310dfe9ccd85d2976b0ebfb683c818 (diff) |
Merge pull request #38 from AdaShoelace/change-to-serde
Change to serde
Diffstat (limited to 'src/utils/weather.rs')
-rw-r--r-- | src/utils/weather.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/utils/weather.rs b/src/utils/weather.rs index 05fa60b..9dc053b 100644 --- a/src/utils/weather.rs +++ b/src/utils/weather.rs @@ -1,14 +1,14 @@ -use crate::types::Config; +use crate::config::CONFIG; // will make a GET request from wttr.in -pub fn get_weather(config: &Config) -> String { - let format = if config.weather.format.is_empty() { +pub fn get_weather() -> String { + let format = if CONFIG.weather.format.is_empty() { String::from("%l:+%t") } else { - config.weather.format.clone() + CONFIG.weather.format.clone() }; - let url = format!("http://wttr.in/{}?format=\"{}", config.weather.city, format); + let url = format!("http://wttr.in/{}?format=\"{}", CONFIG.weather.city, format); let err_string = String::from("Error"); let res = match minreq::get(url).send() { Ok(resp) => match resp.as_str() { @@ -18,5 +18,5 @@ pub fn get_weather(config: &Config) -> String { Err(_) => err_string, }; - format!(" {} {} {}", config.weather.icon, res, config.seperator) + format!(" {} {} {}", CONFIG.weather.icon, res, CONFIG.seperator) } |