diff rust/src/types.rs @ 626:efcbe0d3afd6 rust

fix to work with hyper
author Matt Johnston <matt@ucc.asn.au>
date Wed, 06 Dec 2017 00:09:45 +0800
parents 03167105f6de
children 490e9e15b98c
line wrap: on
line diff
--- a/rust/src/types.rs	Wed Dec 06 00:08:46 2017 +0800
+++ b/rust/src/types.rs	Wed Dec 06 00:09:45 2017 +0800
@@ -11,7 +11,7 @@
 use futures::{Stream,IntoFuture};
 use serde::{Deserialize,Serialize};
 use toml;
-use curl;
+use hyper;
 use serde_json;
 
 #[derive(Debug)]
@@ -42,7 +42,7 @@
     ParseFloat(std::num::ParseFloatError),
     TomlDe(toml::de::Error),
     SerdeJson(serde_json::Error),
-    Curl(curl::Error),
+    Hyper(hyper::Error),
 }
 
 #[derive(Debug)]
@@ -64,7 +64,7 @@
             TemplogErrorKind::ParseFloat(ref e) => Some(e),
             TemplogErrorKind::TomlDe(ref e) => Some(e),
             TemplogErrorKind::SerdeJson(ref e) => Some(e),
-            TemplogErrorKind::Curl(ref e) => Some(e),
+            TemplogErrorKind::Hyper(ref e) => Some(e),
         }
     }
 
@@ -82,7 +82,7 @@
             TemplogErrorKind::TomlDe(ref e) => write!(f, ": {}", e),
             TemplogErrorKind::SerdeJson(ref e) => write!(f, ": {}", e),
             TemplogErrorKind::ParseFloat(ref e) => write!(f, ": {}", e),
-            TemplogErrorKind::Curl(ref e) => write!(f, ": {}", e),
+            TemplogErrorKind::Hyper(ref e) => write!(f, ": {}", e),
         };
         Ok(())
     }
@@ -105,8 +105,8 @@
         TemplogError::new_kind(msg, TemplogErrorKind::ParseFloat(e))
     }
 
-    pub fn new_curl(msg: &str, e: curl::Error) -> Self {
-        TemplogError::new_kind(msg, TemplogErrorKind::Curl(e))
+    pub fn new_hyper(msg: &str, e: hyper::Error) -> Self {
+        TemplogError::new_kind(msg, TemplogErrorKind::Hyper(e))
     }
 
     pub fn new_serde_json(msg: &str, e: serde_json::Error) -> Self {
@@ -138,7 +138,7 @@
             TemplogErrorKind::TomlDe(_) => "Templog toml error",
             TemplogErrorKind::SerdeJson(_) => "Templog Json decode error",
             TemplogErrorKind::ParseFloat(_) => "Templog parse error",
-            TemplogErrorKind::Curl(_) => "Templog curl http error",
+            TemplogErrorKind::Hyper(_) => "Templog http error",
         }
     }
 }
@@ -161,9 +161,9 @@
     }
 }
 
-impl From<curl::Error> for TemplogError {
-    fn from(e: curl::Error) -> Self {
-        TemplogError::new_curl("", e)
+impl From<hyper::Error> for TemplogError {
+    fn from(e: hyper::Error) -> Self {
+        TemplogError::new_hyper("", e)
     }
 }