Skip to content

Commit

Permalink
feat: derive Clone for mdns::Event
Browse files Browse the repository at this point in the history
Derive trait `Clone` for `mdns::Event`. This makes cloning its contents without destroying type information possible.



Related #3593.

Pull-Request: #3606.
  • Loading branch information
DrHuangMHT authored Mar 13, 2023
1 parent 8927abf commit 9d05c61
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
5 changes: 5 additions & 0 deletions protocols/mdns/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
# 0.43.1 [unreleased]

- Derive `Clone` for `mdns::Event`. See [PR 3606].

[PR 3606]: https://github.com/libp2p/rust-libp2p/pull/3606
# 0.43.0

- Update to `libp2p-core` `v0.39.0`.
Expand Down
4 changes: 3 additions & 1 deletion protocols/mdns/src/behaviour.rs
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ where
}

/// Event that can be produced by the `Mdns` behaviour.
#[derive(Debug)]
#[derive(Debug, Clone)]
pub enum Event {
/// Discovered nodes through mDNS.
Discovered(DiscoveredAddrsIter),
Expand All @@ -352,6 +352,7 @@ pub enum Event {
}

/// Iterator that produces the list of addresses that have been discovered.
#[derive(Clone)]
pub struct DiscoveredAddrsIter {
inner: smallvec::IntoIter<[(PeerId, Multiaddr); 4]>,
}
Expand Down Expand Up @@ -379,6 +380,7 @@ impl fmt::Debug for DiscoveredAddrsIter {
}

/// Iterator that produces the list of addresses that have expired.
#[derive(Clone)]
pub struct ExpiredAddrsIter {
inner: smallvec::IntoIter<[(PeerId, Multiaddr); 4]>,
}
Expand Down

0 comments on commit 9d05c61

Please sign in to comment.