diff options
| author | Namilskyy <alive6863@gmail.com> | 2025-03-25 22:20:05 +0300 |
|---|---|---|
| committer | Namilskyy <alive6863@gmail.com> | 2025-03-25 22:20:26 +0300 |
| commit | e687e9bd48ce383894fd499595fc25c2dd8ca024 (patch) | |
| tree | 45fb75296303dabe37f938d8f46e02c707eba485 /src/configmanager.rs | |
| parent | b581af3a76cba646ec58776fcfcca5821bf56221 (diff) | |
Fixed errors and bugs.
Diffstat (limited to 'src/configmanager.rs')
| -rw-r--r-- | src/configmanager.rs | 40 |
1 files changed, 17 insertions, 23 deletions
diff --git a/src/configmanager.rs b/src/configmanager.rs index fb8ccc1..0bbbb73 100644 --- a/src/configmanager.rs +++ b/src/configmanager.rs @@ -3,25 +3,23 @@ use serde::Deserialize; use dirs::home_dir; use std::path::PathBuf; -impl WeatherFetch{ -#[derive(Deserialize)] +#[derive(Debug, Deserialize)] pub struct Config { - lat: String, //Latitude, decimal (-90; 90) - lon: String, //Longitude, decimal (-180; 180) - exclude: String, //By using this parameter you can exclude some parts of the weather - appid: String, //Your OpenWeatherMap API key - lang: String, //Output language - units: String, //Units of measurement - cache: bool, //Cacheing next Weather to dont use internet in next call - rain: String, //Path to rain image (png/jpg) or ASCII art int .txt - sunny: String, //Path to sunny image (png/jpg) or ASCII art int .txt - snowy: String, + pub lat: String, + pub lon: String, + pub exclude: String, + pub appid: String, + pub lang: String, + pub units: String, + pub cache: bool, + pub rain: String, + pub sunny: String, + pub snowy: String, } - //More info: OpenWeatherMap.org/api/one-call3 -impl Config{ +impl Config { pub fn load() -> Result<Self, Box<dyn std::error::Error>> { - let mut path = home_dir().ok_or("Не удалось найти домашнюю директорию")?; + let mut path = home_dir().ok_or("Home directory not found")?; path.push(".config/WeatherFetch/Config.toml"); let config_str = fs::read_to_string(path)?; @@ -30,14 +28,10 @@ impl Config{ } } -pub fn handle_config(config: &Config) -> Result<(), Box<dyn std::error::Error>> { - // Пока недоделано +pub fn handle_config(_config: &Config) -> Result<(), Box<dyn std::error::Error>> { Ok(()) } -pub fn gen_standart_conf() { - -} - -} - +pub fn gen_standard_conf() { + // TODO: Implement +}
\ No newline at end of file |
