From e7395bac9263cd5773ac8d6cf6db2ed9427065c2 Mon Sep 17 00:00:00 2001 From: Ibiyemi Abiodun Date: Wed, 29 Dec 2021 14:45:26 -0500 Subject: [PATCH 1/3] derive Clone for KademliaEvent --- protocols/kad/src/behaviour.rs | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/protocols/kad/src/behaviour.rs b/protocols/kad/src/behaviour.rs index f9f9f2437d5..7ecc956ce9a 100644 --- a/protocols/kad/src/behaviour.rs +++ b/protocols/kad/src/behaviour.rs @@ -2382,7 +2382,7 @@ pub struct PeerRecord { /// The events produced by the `Kademlia` behaviour. /// /// See [`NetworkBehaviour::poll`]. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum KademliaEvent { /// An inbound request has been received and handled. // @@ -2453,7 +2453,7 @@ pub enum KademliaEvent { } /// Information about a received and handled inbound request. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum InboundRequest { /// Request for the list of nodes whose IDs are the closest to `key`. FindNode { num_closer_peers: usize }, @@ -2486,7 +2486,7 @@ pub enum InboundRequest { } /// The results of Kademlia queries. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum QueryResult { /// The result of [`Kademlia::bootstrap`]. Bootstrap(BootstrapResult), @@ -2583,7 +2583,7 @@ pub struct PutRecordOk { } /// The error result of [`Kademlia::put_record`]. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum PutRecordError { QuorumFailed { key: record::Key, @@ -2718,7 +2718,7 @@ pub struct AddProviderOk { } /// The possible errors when publishing a provider record. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum AddProviderError { /// The query timed out. Timeout { key: record::Key }, From 973dc1ef3d14e8bb9f1993f306c0ca2067797897 Mon Sep 17 00:00:00 2001 From: Ibiyemi Abiodun Date: Thu, 30 Dec 2021 11:13:39 -0500 Subject: [PATCH 2/3] update changelog --- protocols/kad/CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/protocols/kad/CHANGELOG.md b/protocols/kad/CHANGELOG.md index 5bc5b4f645b..9be1e2f1222 100644 --- a/protocols/kad/CHANGELOG.md +++ b/protocols/kad/CHANGELOG.md @@ -4,7 +4,10 @@ - Migrate to Rust edition 2021 (see [PR 2339]). +- Derive `Clone` for `KademliaEvent` (see [PR 2411]) + [PR 2339]: https://github.com/libp2p/rust-libp2p/pull/2339 +[PR 2411]: https://github.com/libp2p/rust-libp2p/pull/2411 # 0.33.0 [2021-11-16] From a162807958140eb40f272dce8391bbdb74524b7b Mon Sep 17 00:00:00 2001 From: Ibiyemi Abiodun Date: Thu, 30 Dec 2021 11:42:35 -0500 Subject: [PATCH 3/3] implement clone for kad::record::store::Error --- protocols/kad/src/record/store.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/protocols/kad/src/record/store.rs b/protocols/kad/src/record/store.rs index 9347afedd7c..98f356520ba 100644 --- a/protocols/kad/src/record/store.rs +++ b/protocols/kad/src/record/store.rs @@ -30,7 +30,7 @@ use std::borrow::Cow; pub type Result = std::result::Result; /// The possible errors of a `RecordStore` operation. -#[derive(Debug)] +#[derive(Debug, Clone)] pub enum Error { /// The store is at capacity w.r.t. the total number of stored records. MaxRecords,