From e687e9bd48ce383894fd499595fc25c2dd8ca024 Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Tue, 25 Mar 2025 22:20:05 +0300 Subject: Fixed errors and bugs. --- src/configmanager.rs | 40 +++++++++++++++++----------------------- 1 file changed, 17 insertions(+), 23 deletions(-) (limited to 'src/configmanager.rs') 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> { - 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> { - // Пока недоделано +pub fn handle_config(_config: &Config) -> Result<(), Box> { Ok(()) } -pub fn gen_standart_conf() { - -} - -} - +pub fn gen_standard_conf() { + // TODO: Implement +} \ No newline at end of file -- cgit v1.2.3