Skip to content

Commit

Permalink
nostr: impl Copy for Keys
Browse files Browse the repository at this point in the history
  • Loading branch information
yukibtc committed Sep 14, 2023
1 parent 95d3404 commit 0d84b82
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
10 changes: 5 additions & 5 deletions crates/nostr-sdk/src/client/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,9 @@ impl Drop for Client {
let _ = self
.dropped
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| Some(true));
let pool = self.clone();
let client: Client = self.clone();
thread::spawn(async move {
pool.shutdown()
client.shutdown()
.await
.expect("Impossible to drop the client")
});
Expand Down Expand Up @@ -166,7 +166,7 @@ impl Client {
pub fn with_opts(keys: &Keys, opts: Options) -> Self {
Self {
pool: RelayPool::new(opts.pool),
keys: keys.clone(),
keys: *keys,
opts,
dropped: Arc::new(AtomicBool::new(false)),
#[cfg(feature = "nip46")]
Expand All @@ -189,7 +189,7 @@ impl Client {
) -> Self {
Self {
pool: RelayPool::new(opts.pool),
keys: app_keys.clone(),
keys: *app_keys,
opts,
dropped: Arc::new(AtomicBool::new(false)),
remote_signer: Some(remote_signer),
Expand All @@ -203,7 +203,7 @@ impl Client {

/// Get current [`Keys`]
pub fn keys(&self) -> Keys {
self.keys.clone()
self.keys
}

/// Get [`RelayPool`]
Expand Down
2 changes: 1 addition & 1 deletion crates/nostr/src/key/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub trait FromPkStr: Sized {
}

/// Keys
#[derive(Debug, Clone, PartialEq, Eq)]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub struct Keys {
public_key: XOnlyPublicKey,
key_pair: Option<KeyPair>,
Expand Down

0 comments on commit 0d84b82

Please sign in to comment.