diff options
Diffstat (limited to 'src/parser.rs')
| -rw-r--r-- | src/parser.rs | 23 |
1 files changed, 8 insertions, 15 deletions
diff --git a/src/parser.rs b/src/parser.rs index f9976e6..e8eff39 100644 --- a/src/parser.rs +++ b/src/parser.rs @@ -1,13 +1,8 @@ use reqwest::{Error, Client, get}; use chrono::{DateTime, Utc, prelude::*}; -use serde::{Serialize, Deserealize}; -use std::net::{IpAddr, SocketAddr, UpdSocket}; +use serde::{Serialize, Deserialize}; -mod configmanager; - -use configmanager::*; - -static ErrBuff: String = reqwest::Error; +use crate::configmanager::{Config}; //API answer struct`s #[derive(Debug, Serialize, Deserialize)] @@ -130,15 +125,15 @@ pub struct Alert { -pub fn get_location(let coords_args: bool, config: &Config) -> Reslut<(), >{ +pub fn get_location(let coords_args: bool, config: &Config) -> Result<(), String>{ //Get the lat and lon for API call configmanager::handle_config(); - if configmanager::Config.lat.is_empty() || configmanager::Config.lon.is_empty() && !coords_args{ + if Config.lat.is_empty() || Config.lon.is_empty() && !coords_args{ println!("No coordinates in configuration file or conf not founded."); println!("HINT: Try create ~/.config/WeatherFetch/Config.toml"); println!("HINT: And add `lat(<int>)`, `lon(<int>)`."); - println!("HINT: To get more info check https://openweathermap.org/api/one-call-3") - + println!("HINT: To get more info check https://openweathermap.org/api/one-call-3"); + Err("No coordinates in config or args.".into()) } else { Ok(()) @@ -146,8 +141,6 @@ pub fn get_location(let coords_args: bool, config: &Config) -> Reslut<(), >{ } - -pub async fn parse_weather(config: &Config) -> Result<(), reqwest::Error> { - +pub async fn parse_weather(_config: &Config) -> Result<(), reqwest::Error> { Ok(()) -}
\ No newline at end of file +} |
