debug: implemented fmt::Debug for Pubkey
This commit is contained in:
committed by
William Casarin
parent
dbb164970c
commit
f00b301e88
@@ -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<Pubkey> for String {
|
||||
fn from(pk: Pubkey) -> Self {
|
||||
pk.hex()
|
||||
|
||||
Reference in New Issue
Block a user