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 <flokli@flokli.de>
Reviewed-by: Connor Brewster <cbrewster@hey.com>
Tested-by: BuildkiteCI
This commit is contained in:
Florian Klink 2024-03-17 21:05:54 +02:00 committed by clbot
parent fa8e706b9b
commit 3b1c9172f6

View file

@ -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))
}
}