added request.rs
This commit is contained in:
parent
c8b3892389
commit
e4473f6566
@ -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)
|
||||
@ -84,8 +86,3 @@ pub fn init_config() -> Configuration {
|
||||
|
||||
config
|
||||
}
|
||||
|
||||
pub fn get_request(request: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||
let response = reqwest::get(request);
|
||||
response
|
||||
}
|
@ -10,6 +10,7 @@ use ws2812_spi::Ws2812;
|
||||
mod app;
|
||||
mod config;
|
||||
mod generate;
|
||||
mod request;
|
||||
|
||||
const NUM_LEDS: usize = 150;
|
||||
|
||||
|
4
src/request.rs
Normal file
4
src/request.rs
Normal file
@ -0,0 +1,4 @@
|
||||
pub fn get_request(request: &String) -> Result<reqwest::Response, reqwest::Error> {
|
||||
let response = reqwest::get(request);
|
||||
response
|
||||
}
|
Loading…
Reference in New Issue
Block a user