Skip to content

Commit

Permalink
feat(kad): impl Display on QueryId
Browse files Browse the repository at this point in the history
Fixes: #4813.

Pull-Request: #4814.
  • Loading branch information
stormshield-frb authored Nov 10, 2023
1 parent 2ecc7cf commit 2fb671c
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 3 deletions.
2 changes: 1 addition & 1 deletion Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ libp2p-floodsub = { version = "0.44.0", path = "protocols/floodsub" }
libp2p-gossipsub = { version = "0.46.0", path = "protocols/gossipsub" }
libp2p-identify = { version = "0.44.0", path = "protocols/identify" }
libp2p-identity = { version = "0.2.7" }
libp2p-kad = { version = "0.45.0", path = "protocols/kad" }
libp2p-kad = { version = "0.45.1", path = "protocols/kad" }
libp2p-mdns = { version = "0.45.0", path = "protocols/mdns" }
libp2p-memory-connection-limits = { version = "0.2.0", path = "misc/memory-connection-limits" }
libp2p-metrics = { version = "0.14.0", path = "misc/metrics" }
Expand Down
5 changes: 5 additions & 0 deletions protocols/kad/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
## 0.45.1 - unreleased

- Add `std::fmt::Display` implementation on `QueryId`.
See [PR 4814](https://github.com/libp2p/rust-libp2p/pull/4814).

## 0.45.0

- Remove deprecated `kad::Config::set_connection_idle_timeout` in favor of `SwarmBuilder::idle_connection_timeout`.
Expand Down
2 changes: 1 addition & 1 deletion protocols/kad/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name = "libp2p-kad"
edition = "2021"
rust-version = { workspace = true }
description = "Kademlia protocol for libp2p"
version = "0.45.0"
version = "0.45.1"
authors = ["Parity Technologies <[email protected]>"]
license = "MIT"
repository = "https://github.com/libp2p/rust-libp2p"
Expand Down
6 changes: 6 additions & 0 deletions protocols/kad/src/query.rs
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,12 @@ impl<TInner> QueryPool<TInner> {
#[derive(Debug, Copy, Clone, Hash, PartialEq, Eq)]
pub struct QueryId(usize);

impl std::fmt::Display for QueryId {
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
write!(f, "{}", self.0)
}
}

/// The configuration for queries in a `QueryPool`.
#[derive(Debug, Clone)]
pub(crate) struct QueryConfig {
Expand Down

0 comments on commit 2fb671c

Please sign in to comment.