Skip to content

Commit 0d84b82

Browse files
committed
nostr: impl Copy for Keys
1 parent 95d3404 commit 0d84b82

File tree

2 files changed

+6
-6
lines changed

2 files changed

+6
-6
lines changed

crates/nostr-sdk/src/client/mod.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -128,9 +128,9 @@ impl Drop for Client {
128128
let _ = self
129129
.dropped
130130
.fetch_update(Ordering::SeqCst, Ordering::SeqCst, |_| Some(true));
131-
let pool = self.clone();
131+
let client: Client = self.clone();
132132
thread::spawn(async move {
133-
pool.shutdown()
133+
client.shutdown()
134134
.await
135135
.expect("Impossible to drop the client")
136136
});
@@ -166,7 +166,7 @@ impl Client {
166166
pub fn with_opts(keys: &Keys, opts: Options) -> Self {
167167
Self {
168168
pool: RelayPool::new(opts.pool),
169-
keys: keys.clone(),
169+
keys: *keys,
170170
opts,
171171
dropped: Arc::new(AtomicBool::new(false)),
172172
#[cfg(feature = "nip46")]
@@ -189,7 +189,7 @@ impl Client {
189189
) -> Self {
190190
Self {
191191
pool: RelayPool::new(opts.pool),
192-
keys: app_keys.clone(),
192+
keys: *app_keys,
193193
opts,
194194
dropped: Arc::new(AtomicBool::new(false)),
195195
remote_signer: Some(remote_signer),
@@ -203,7 +203,7 @@ impl Client {
203203

204204
/// Get current [`Keys`]
205205
pub fn keys(&self) -> Keys {
206-
self.keys.clone()
206+
self.keys
207207
}
208208

209209
/// Get [`RelayPool`]

crates/nostr/src/key/mod.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,7 @@ pub trait FromPkStr: Sized {
8181
}
8282

8383
/// Keys
84-
#[derive(Debug, Clone, PartialEq, Eq)]
84+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
8585
pub struct Keys {
8686
public_key: XOnlyPublicKey,
8787
key_pair: Option<KeyPair>,

0 commit comments

Comments
 (0)