Skip to content

Commit

Permalink
nostr: better Debug trait impl for Tag
Browse files Browse the repository at this point in the history
Signed-off-by: Yuki Kishimoto <[email protected]>
  • Loading branch information
yukibtc committed Aug 8, 2024
1 parent 6ffebcb commit 66028a0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
* nostr: add NIP-50 support to `Filter::match_event` method ([Yuki Kishimoto])
* nostr: remove `Arc<T>` from `OnceCell<T>` in `Event` and `Tag` ([Yuki Kishimoto])
* nostr: move `sig` field from `PartialEvent` to `MissingPartialEvent` ([Yuki Kishimoto])
* nostr: better `Debug` trait impl for `Tag`
* pool: take mutex ownership instead of clone in `InternalRelayPool::get_events_from` ([Yuki Kishimoto])
* pool: remove IDs collection from `InternalRelayPool::get_events_from` ([Yuki Kishimoto])
* pool: better checks before perform queries or send messages to relays ([Yuki Kishimoto])
Expand Down
9 changes: 8 additions & 1 deletion crates/nostr/src/event/tag/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
use alloc::string::{String, ToString};
use alloc::vec::Vec;
use core::cmp::Ordering;
use core::fmt;
use core::hash::{Hash, Hasher};

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

/// Tag
#[derive(Debug, Clone)]
#[derive(Clone)]
pub struct Tag {
buf: Vec<String>,
standardized: OnceCell<Option<TagStandard>>,
}

impl fmt::Debug for Tag {
fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
f.debug_tuple("Tag").field(&self.buf).finish()
}
}

impl PartialEq for Tag {
fn eq(&self, other: &Self) -> bool {
self.buf == other.buf
Expand Down

0 comments on commit 66028a0

Please sign in to comment.