diff options
Diffstat (limited to 'game_server/src/backend_connection.rs')
-rw-r--r-- | game_server/src/backend_connection.rs | 31 |
1 files changed, 0 insertions, 31 deletions
diff --git a/game_server/src/backend_connection.rs b/game_server/src/backend_connection.rs deleted file mode 100644 index 9307c4a..0000000 --- a/game_server/src/backend_connection.rs +++ /dev/null @@ -1,31 +0,0 @@ -use reqwest::{Response, Client, Url, UrlError, Error as ReqError}; - -pub struct BackendConnection { - host: String, - client: Client, - last_response: Option<Result<Response, ReqError>> -} - -impl BackendConnection { - pub fn new(host: &str) -> Self { - BackendConnection { - host: host.to_string(), - client: Client::new(), - last_response: None - } - } - - pub fn request(&mut self, location: &str) -> Result<(), UrlError> { - Ok(self.last_response = - Some(self.client.get(Url::parse(&format!("{}{}", self.host, location))?) - .send())) - } - - pub fn get_response(&self) -> &Option<Result<Response, ReqError>> { - &self.last_response - } - - pub fn host_name<'a>(&'a self) -> &'a str { - &self.host - } -} |