From 667a259c981df9f08c49d4fe83fc2f907be06784 Mon Sep 17 00:00:00 2001 From: Namilskyy Date: Mon, 24 Mar 2025 21:42:48 +0300 Subject: Start dev --- src/configmanager.rs | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 src/configmanager.rs (limited to 'src/configmanager.rs') diff --git a/src/configmanager.rs b/src/configmanager.rs new file mode 100644 index 0000000..e046aa2 --- /dev/null +++ b/src/configmanager.rs @@ -0,0 +1,24 @@ +use std::fs; +use serde::Deserialize; + +impl WeatherFetch{ +#[derive(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, + //More info: OpenWeatherMap.org/api/one-call3 +} + +pub fn handle_config() -> Result<(), Box>{ + let Config_str = fs::read_to_string("~/.config/WeatherFetch/Config.toml"); + let Config_parse: Config = toml::from_str(&data)?.except(); +} +} -- cgit v1.2.3