about summary refs log tree commit diff
path: root/tvix/castore/src/digests.rs
diff options
context:
space:
mode:
authorFlorian Klink <flokli@flokli.de>2024-03-17T19·05+0200
committerclbot <clbot@tvl.fyi>2024-03-17T22·18+0000
commit3b1c9172f61985ce070b276e13855f82ea234c8b (patch)
tree3f1ca7c7a702e8c7da6ffb48e54050dbefa754a5 /tvix/castore/src/digests.rs
parentfa8e706b9b66c1d5f0f64967939861fe00101a22 (diff)
feat(tvix/castore): impl Debug for B3Digest r/7719
Use the same format as Display, b3: followed by the base64
representation. This makes the debug implementation of everything
containing a b3 digest much nicer to read.

Change-Id: I3ca3154d0b6fb07781c8f9c83ece3ff1a6957902
Reviewed-on: https://cl.tvl.fyi/c/depot/+/11181
Autosubmit: flokli <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
Diffstat (limited to 'tvix/castore/src/digests.rs')
-rw-r--r--tvix/castore/src/digests.rs8
1 files changed, 7 insertions, 1 deletions
diff --git a/tvix/castore/src/digests.rs b/tvix/castore/src/digests.rs
index 8a1938c1b649..2311c95c4ddc 100644
--- a/tvix/castore/src/digests.rs
+++ b/tvix/castore/src/digests.rs
@@ -2,7 +2,7 @@ use bytes::Bytes;
 use data_encoding::BASE64;
 use thiserror::Error;
 
-#[derive(PartialEq, Eq, Hash, Debug)]
+#[derive(PartialEq, Eq, Hash)]
 pub struct B3Digest(Bytes);
 
 // TODO: allow converting these errors to crate::Error
@@ -78,3 +78,9 @@ impl std::fmt::Display for B3Digest {
         write!(f, "b3:{}", BASE64.encode(&self.0))
     }
 }
+
+impl std::fmt::Debug for B3Digest {
+    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
+        write!(f, "b3:{}", BASE64.encode(&self.0))
+    }
+}