Add Display implementations for various ConfidentialTransfer pod structs (#26783)

This commit is contained in:
Tyera Eulberg 2022-07-25 20:09:41 -07:00 committed by GitHub
parent 9e791ec9b7
commit 2114136e59
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 18 additions and 0 deletions

View File

@ -43,6 +43,12 @@ impl fmt::Debug for ElGamalCiphertext {
}
}
impl fmt::Display for ElGamalCiphertext {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", base64::encode(self.0))
}
}
impl Default for ElGamalCiphertext {
fn default() -> Self {
Self::zeroed()
@ -59,6 +65,12 @@ impl fmt::Debug for ElGamalPubkey {
}
}
impl fmt::Display for ElGamalPubkey {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", base64::encode(self.0))
}
}
#[derive(Clone, Copy, Default, Pod, Zeroable, PartialEq, Eq)]
#[repr(transparent)]
pub struct PedersenCommitment(pub [u8; 32]);
@ -180,6 +192,12 @@ impl fmt::Debug for AeCiphertext {
}
}
impl fmt::Display for AeCiphertext {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "{}", base64::encode(self.0))
}
}
impl Default for AeCiphertext {
fn default() -> Self {
Self::zeroed()