Skip to content

Commit

Permalink
feat(kad): impl Display on QueryId
Browse files Browse the repository at this point in the history
  • Loading branch information
stormshield-frb committed Nov 8, 2023
1 parent dbfda10 commit 607ee97
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
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
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 607ee97

Please sign in to comment.