notedeck

One damus client to rule them all
git clone git://jb55.com/notedeck
Log | Files | Refs | README | LICENSE

commit bdea3da5f02ddef522f562809e18496774df2802
parent de8029d60f66e4c20a371aa5aa7c53c2904950ad
Author: William Casarin <jb55@jb55.com>
Date:   Mon, 18 Nov 2024 17:08:58 -0800

enostr: add Deref trait for Pubkey

Diffstat:
Menostr/src/pubkey.rs | 9+++++++++
1 file changed, 9 insertions(+), 0 deletions(-)

diff --git a/enostr/src/pubkey.rs b/enostr/src/pubkey.rs @@ -3,6 +3,7 @@ use serde::{Deserialize, Deserializer, Serialize, Serializer}; use crate::Error; use nostr::bech32::Hrp; use std::fmt; +use std::ops::Deref; use tracing::debug; #[derive(Eq, PartialEq, Clone, Copy, Hash)] @@ -10,6 +11,14 @@ pub struct Pubkey([u8; 32]); static HRP_NPUB: Hrp = Hrp::parse_unchecked("npub"); +impl Deref for Pubkey { + type Target = [u8; 32]; + + fn deref(&self) -> &Self::Target { + &self.0 + } +} + impl Pubkey { pub fn new(data: [u8; 32]) -> Self { Self(data)