From ca32f7b40394be0be728a13566777d4286cad099 Mon Sep 17 00:00:00 2001 From: Liam Aharon Date: Tue, 17 Sep 2024 17:36:01 +0200 Subject: [PATCH] improved PublicKey debug impl --- src/key.rs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/key.rs b/src/key.rs index 463ae40a..6c1d8b5f 100644 --- a/src/key.rs +++ b/src/key.rs @@ -144,7 +144,7 @@ impl str::FromStr for SecretKey { /// ``` /// [`bincode`]: https://docs.rs/bincode /// [`cbor`]: https://docs.rs/cbor -#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] #[repr(transparent)] pub struct PublicKey(ffi::PublicKey); impl_fast_comparisons!(PublicKey); @@ -163,6 +163,10 @@ impl fmt::Display for PublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } +impl fmt::Debug for PublicKey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } +} + impl str::FromStr for PublicKey { type Err = Error; fn from_str(s: &str) -> Result { @@ -1138,7 +1142,7 @@ impl CPtr for Keypair { /// ``` /// [`bincode`]: https://docs.rs/bincode /// [`cbor`]: https://docs.rs/cbor -#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)] +#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)] pub struct XOnlyPublicKey(ffi::XOnlyPublicKey); impl_fast_comparisons!(XOnlyPublicKey); @@ -1156,6 +1160,10 @@ impl fmt::Display for XOnlyPublicKey { fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } } +impl fmt::Debug for XOnlyPublicKey { + fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) } +} + impl str::FromStr for XOnlyPublicKey { type Err = Error; fn from_str(s: &str) -> Result {