diff options
author | Dennis Kobert <d-kobert@web.de> | 2019-06-12 21:51:39 +0200 |
---|---|---|
committer | Dennis Kobert <d-kobert@web.de> | 2019-06-12 21:51:39 +0200 |
commit | 9e9c1c822a64c0a65033b7eed07ea661a385cecc (patch) | |
tree | ee699d4e93bb4204f5f4e04cd14f6d77365b81b4 /game_server/src/backend_connection.rs | |
parent | 304437b834e8c87687f68333ae67a13ee1377a73 (diff) | |
parent | 3a3d0fc3d4733f8908e23a03f860d76340479ec4 (diff) |
Merge remote-tracking branch 'origin/master'
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 - } -} |