From f00b301e8857d28123facf98e4ae776d1a82ce52 Mon Sep 17 00:00:00 2001 From: Ken Sedgwick Date: Tue, 13 Aug 2024 12:25:02 -0700 Subject: [PATCH] debug: implemented fmt::Debug for Pubkey --- enostr/src/pubkey.rs | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/enostr/src/pubkey.rs b/enostr/src/pubkey.rs index ad8c8494..45d2a66b 100644 --- a/enostr/src/pubkey.rs +++ b/enostr/src/pubkey.rs @@ -5,7 +5,7 @@ use nostr::bech32::Hrp; use std::fmt; use tracing::debug; -#[derive(Debug, Eq, PartialEq, Clone, Copy, Hash)] +#[derive(Eq, PartialEq, Clone, Copy, Hash)] pub struct Pubkey([u8; 32]); static HRP_NPUB: Hrp = Hrp::parse_unchecked("npub"); @@ -80,6 +80,12 @@ impl fmt::Display for Pubkey { } } +impl fmt::Debug for Pubkey { + fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result { + write!(f, "{}", self.hex()) + } +} + impl From for String { fn from(pk: Pubkey) -> Self { pk.hex()