Skip to content

Commit 736adc9

Browse files
committed
Merge #745: Improved PublicKey and XOnlyPublicKey Debug impl
ca32f7b improved PublicKey debug impl (Liam Aharon) Pull request description: Closes #729 Adjusts `Debug` impls to write serialized hex representation of the keys rather than the inner u8 bytes. ACKs for top commit: apoelstra: ACK ca32f7b successfully ran local tests tcharding: ACK ca32f7b Tree-SHA512: e73c10733fe3b493492c16f6b2e68149339395b882c70d2d80b9b5e0d75ec671155b09a101ca019e44260413ecb82e93919f2caf0d2508b5baa641e839689909
2 parents 2a80731 + ca32f7b commit 736adc9

File tree

1 file changed

+10
-2
lines changed

1 file changed

+10
-2
lines changed

src/key.rs

+10-2
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,7 @@ impl str::FromStr for SecretKey {
144144
/// ```
145145
/// [`bincode`]: https://docs.rs/bincode
146146
/// [`cbor`]: https://docs.rs/cbor
147-
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
147+
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
148148
#[repr(transparent)]
149149
pub struct PublicKey(ffi::PublicKey);
150150
impl_fast_comparisons!(PublicKey);
@@ -163,6 +163,10 @@ impl fmt::Display for PublicKey {
163163
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) }
164164
}
165165

166+
impl fmt::Debug for PublicKey {
167+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) }
168+
}
169+
166170
impl str::FromStr for PublicKey {
167171
type Err = Error;
168172
fn from_str(s: &str) -> Result<PublicKey, Error> {
@@ -1138,7 +1142,7 @@ impl CPtr for Keypair {
11381142
/// ```
11391143
/// [`bincode`]: https://docs.rs/bincode
11401144
/// [`cbor`]: https://docs.rs/cbor
1141-
#[derive(Copy, Clone, Debug, PartialOrd, Ord, PartialEq, Eq, Hash)]
1145+
#[derive(Copy, Clone, PartialOrd, Ord, PartialEq, Eq, Hash)]
11421146
pub struct XOnlyPublicKey(ffi::XOnlyPublicKey);
11431147
impl_fast_comparisons!(XOnlyPublicKey);
11441148

@@ -1156,6 +1160,10 @@ impl fmt::Display for XOnlyPublicKey {
11561160
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) }
11571161
}
11581162

1163+
impl fmt::Debug for XOnlyPublicKey {
1164+
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result { fmt::LowerHex::fmt(self, f) }
1165+
}
1166+
11591167
impl str::FromStr for XOnlyPublicKey {
11601168
type Err = Error;
11611169
fn from_str(s: &str) -> Result<XOnlyPublicKey, Error> {

0 commit comments

Comments
 (0)