Skip to content

Commit 66028a0

Browse files
committed
nostr: better Debug trait impl for Tag
Signed-off-by: Yuki Kishimoto <[email protected]>
1 parent 6ffebcb commit 66028a0

File tree

2 files changed

+9
-1
lines changed

2 files changed

+9
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@
3636
* nostr: add NIP-50 support to `Filter::match_event` method ([Yuki Kishimoto])
3737
* nostr: remove `Arc<T>` from `OnceCell<T>` in `Event` and `Tag` ([Yuki Kishimoto])
3838
* nostr: move `sig` field from `PartialEvent` to `MissingPartialEvent` ([Yuki Kishimoto])
39+
* nostr: better `Debug` trait impl for `Tag`
3940
* pool: take mutex ownership instead of clone in `InternalRelayPool::get_events_from` ([Yuki Kishimoto])
4041
* pool: remove IDs collection from `InternalRelayPool::get_events_from` ([Yuki Kishimoto])
4142
* pool: better checks before perform queries or send messages to relays ([Yuki Kishimoto])

crates/nostr/src/event/tag/mod.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
use alloc::string::{String, ToString};
88
use alloc::vec::Vec;
99
use core::cmp::Ordering;
10+
use core::fmt;
1011
use core::hash::{Hash, Hasher};
1112

1213
#[cfg(feature = "std")]
@@ -33,12 +34,18 @@ use crate::types::url::Url;
3334
use crate::{ImageDimensions, PublicKey, SingleLetterTag, Timestamp, UncheckedUrl};
3435

3536
/// Tag
36-
#[derive(Debug, Clone)]
37+
#[derive(Clone)]
3738
pub struct Tag {
3839
buf: Vec<String>,
3940
standardized: OnceCell<Option<TagStandard>>,
4041
}
4142

43+
impl fmt::Debug for Tag {
44+
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
45+
f.debug_tuple("Tag").field(&self.buf).finish()
46+
}
47+
}
48+
4249
impl PartialEq for Tag {
4350
fn eq(&self, other: &Self) -> bool {
4451
self.buf == other.buf

0 commit comments

Comments
 (0)