diff rust/src/types.rs @ 639:89818a14648b rust tip

- switch to using anyhow for errors, surf for http runs but surf has problems
author Matt Johnston <matt@ucc.asn.au>
date Thu, 28 Nov 2019 23:57:00 +0800
parents a5721c02d3ee
children
line wrap: on
line diff
--- a/rust/src/types.rs	Sat Nov 09 11:35:59 2019 +0800
+++ b/rust/src/types.rs	Thu Nov 28 23:57:00 2019 +0800
@@ -8,7 +8,6 @@
 
 use std;
 
-use hyper;
 use serde_json;
 
 #[derive(Debug,Clone)]
@@ -38,7 +37,6 @@
     Io(io::Error),
     ParseFloat(std::num::ParseFloatError),
     SerdeJson(serde_json::Error),
-    Hyper(hyper::Error),
 }
 
 #[derive(Debug)]
@@ -59,7 +57,6 @@
             TemplogErrorKind::Io(ref e) => Some(e),
             TemplogErrorKind::ParseFloat(ref e) => Some(e),
             TemplogErrorKind::SerdeJson(ref e) => Some(e),
-            TemplogErrorKind::Hyper(ref e) => Some(e),
         }
     }
 
@@ -76,7 +73,6 @@
             TemplogErrorKind::Io(ref e) => write!(f, ": {}", e),
             TemplogErrorKind::SerdeJson(ref e) => write!(f, ": {}", e),
             TemplogErrorKind::ParseFloat(ref e) => write!(f, ": {}", e),
-            TemplogErrorKind::Hyper(ref e) => write!(f, ": {}", e),
         }?;
         Ok(())
     }
@@ -95,10 +91,6 @@
         TemplogError::new_kind(msg, TemplogErrorKind::ParseFloat(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 {
         TemplogError::new_kind(msg, TemplogErrorKind::SerdeJson(e))
     }
@@ -127,7 +119,6 @@
             TemplogErrorKind::Io(_) => "Templog IO error",
             TemplogErrorKind::SerdeJson(_) => "Templog Json decode error",
             TemplogErrorKind::ParseFloat(_) => "Templog parse error",
-            TemplogErrorKind::Hyper(_) => "Templog http error",
         }
     }
 }
@@ -144,12 +135,6 @@
     }
 }
 
-impl From<hyper::Error> for TemplogError {
-    fn from(e: hyper::Error) -> Self {
-        TemplogError::new_hyper("", e)
-    }
-}
-
 impl From<serde_json::Error> for TemplogError {
     fn from(e: serde_json::Error) -> Self {
         TemplogError::new_serde_json("", e)