Skip to content
This repository has been archived by the owner on Jan 22, 2025. It is now read-only.

Commit

Permalink
Add Display implementations for various ConfidentialTransfer pod stru…
Browse files Browse the repository at this point in the history
…cts (backport #26783) (#26784)

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

(cherry picked from commit 2114136)

# Conflicts:
#	zk-token-sdk/src/zk_token_elgamal/pod.rs

* Fix conflict

Co-authored-by: Tyera Eulberg <[email protected]>
  • Loading branch information
mergify[bot] and Tyera Eulberg authored Jul 26, 2022
1 parent de3218f commit fcb8585
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions zk-token-sdk/src/zk_token_elgamal/pod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand All @@ -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)]
#[repr(transparent)]
pub struct PedersenCommitment(pub [u8; 32]);
Expand Down Expand Up @@ -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()
Expand Down

0 comments on commit fcb8585

Please sign in to comment.