From 3b1c9172f61985ce070b276e13855f82ea234c8b Mon Sep 17 00:00:00 2001 From: Florian Klink Date: Sun, 17 Mar 2024 21:05:54 +0200 Subject: feat(tvix/castore): impl Debug for B3Digest 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 Reviewed-by: Connor Brewster Tested-by: BuildkiteCI --- tvix/castore/src/digests.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'tvix/castore/src') 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)) + } +} -- cgit 1.4.1