chiark / gitweb /
otter: Further improve error printing
authorIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 May 2021 19:45:40 +0000 (20:45 +0100)
committerIan Jackson <ijackson@chiark.greenend.org.uk>
Sat, 15 May 2021 20:08:23 +0000 (21:08 +0100)
Signed-off-by: Ian Jackson <ijackson@chiark.greenend.org.uk>
src/bundles.rs

index ecc9319ff34e3ac5148fc9bda5ccfb32e310a2db..eff4e329f320753a9d7ff897be83bfa5f7232e37 100644 (file)
@@ -9,7 +9,7 @@ use crate::prelude::*;
 pub use crate::prelude::Sha512Trunc256 as Digester;
 pub type DigestWrite<W> = crate::utils::DigestWrite<Digester, W>;
 
-#[derive(Debug,Copy,Clone,Hash,Eq,PartialEq,Serialize,Deserialize)]
+#[derive(Copy,Clone,Hash,Eq,PartialEq,Serialize,Deserialize)]
 pub struct Hash(pub [u8; 32]);
 
 #[derive(Debug,Copy,Clone,Hash,Eq,PartialEq,Serialize,Deserialize)]
@@ -178,6 +178,13 @@ impl BundleSavefile {
   }
 }
 
+impl Debug for Hash {
+  #[throws(fmt::Error)]
+  fn fmt(&self, f: &mut Formatter) {
+    for v in self.0 { write!(f, "{:02x}", v)?; }
+  }
+}
+
 //---------- pathname handling (including Id leafname) ----------
 
 pub fn b_dir(instance: &InstanceName) -> String {