Skip to content

Commit 357ed40

Browse files
authored
chore: expose hashed_bytes of KBucketKey
Pull-Request: #4698.
1 parent e89a11b commit 357ed40

File tree

2 files changed

+7
-0
lines changed

2 files changed

+7
-0
lines changed

protocols/kad/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66
See [PR 4503](https://github.com/libp2p/rust-libp2p/pull/4503).
77
- Make previously "deprecated" `record` module private.
88
See [PR 4035](https://github.com/libp2p/rust-libp2p/pull/4035).
9+
- Expose hashed bytes of KBucketKey.
10+
See [PR 4698](https://github.com/libp2p/rust-libp2p/pull/4698).
911
- Remove previously deprecated type-aliases.
1012
Users should follow the convention of importing the `libp2p::kad` module and referring to symbols as `kad::Behaviour` etc.
1113
See [PR 4733](https://github.com/libp2p/rust-libp2p/pull/4733).

protocols/kad/src/kbucket/key.rs

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,11 @@ impl<T> Key<T> {
7777
self.bytes.distance(other)
7878
}
7979

80+
/// Exposing the hashed bytes.
81+
pub fn hashed_bytes(&self) -> &[u8] {
82+
&self.bytes.0
83+
}
84+
8085
/// Returns the uniquely determined key with the given distance to `self`.
8186
///
8287
/// This implements the following equivalence:

0 commit comments

Comments
 (0)