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] 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 }, 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,