summaryrefslogtreecommitdiff
path: root/src/configmanager.rs
diff options
context:
space:
mode:
authorNamilskyy <alive6863@gmail.com>2025-03-24 21:42:48 +0300
committerNamilskyy <alive6863@gmail.com>2025-03-24 21:43:40 +0300
commit667a259c981df9f08c49d4fe83fc2f907be06784 (patch)
tree3453e544a913339107b8a6bcb9269e69ab5a57f8 /src/configmanager.rs
parent8ccbfad0cc8ecdcdccaa8766a7316b6a56d5e615 (diff)
Start dev
Diffstat (limited to 'src/configmanager.rs')
-rw-r--r--src/configmanager.rs24
1 files changed, 24 insertions, 0 deletions
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<dyn std::error::Error>>{
+ let Config_str = fs::read_to_string("~/.config/WeatherFetch/Config.toml");
+ let Config_parse: Config = toml::from_str(&data)?.except();
+}
+}