diff --git a/src/config.rs b/src/config.rs index 3ba16c2..d1481ec 100644 --- a/src/config.rs +++ b/src/config.rs @@ -4,7 +4,9 @@ use std::path::Path; use select::document::Document; use select::predicate::Name; -use serde::{Serialize, Deserialize}; +use serde_derive::{Serialize, Deserialize}; + +use crate::request; // config structure #[derive(Serialize, Deserialize, Debug)] @@ -36,7 +38,7 @@ impl Configuration { port = self.port ); - let response = get_request(&request); + let response = request::get_request(&request); match response { Ok(res) => { let document = Document::from_read(res) @@ -58,7 +60,7 @@ impl Configuration { port = self.port ); - let response = get_request(&request); + let response = request::get_request(&request); match response { Ok(res) => { let document = Document::from_read(res) @@ -83,9 +85,4 @@ pub fn init_config() -> Configuration { let config: Configuration = serde_json::from_str(&data).expect("Couldn't parse JSON!"); config -} - -pub fn get_request(request: &String) -> Result { - let response = reqwest::get(request); - response } \ No newline at end of file diff --git a/src/main.rs b/src/main.rs index a681d70..12ab113 100644 --- a/src/main.rs +++ b/src/main.rs @@ -10,6 +10,7 @@ use ws2812_spi::Ws2812; mod app; mod config; mod generate; +mod request; const NUM_LEDS: usize = 150; diff --git a/src/request.rs b/src/request.rs new file mode 100644 index 0000000..405f629 --- /dev/null +++ b/src/request.rs @@ -0,0 +1,4 @@ +pub fn get_request(request: &String) -> Result { + let response = reqwest::get(request); + response +} \ No newline at end of file