chiark / gitweb /
apitest: New Explode error
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 13:02:02 +0000 (14:02 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Mon, 3 May 2021 13:02:02 +0000 (14:02 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
apitest/apitest.rs

index 5bb53ad0c41a105933294c8f3a6abc4243660475..eda2c60ebc084d3f7508178b006e8299351a11e5 100644 (file)
@@ -88,6 +88,18 @@ pub struct Instance(pub InstanceName);
 
 impl AsRef<Opts> for Opts { fn as_ref(&self) -> &Opts { self } }
 
+pub enum Explode { }
+impl<E:Display> From<E> for Explode {
+  fn from(e: E) -> Explode { panic!("exploding on error: {}", e) }
+}
+impl From<Explode> for anyhow::Error {
+  fn from(e: Explode) -> AE { match e { } }
+}
+/*
+impl<E:Error> From<Explode> for E {
+  fn from(e: Explode) -> E { match e { } }
+}*/
+
 // -------------------- Substition --------------------
 
 pub trait Substitutor {