Skip to content

Commit

Permalink
chore: expose hashed_bytes of KBucketKey
Browse files Browse the repository at this point in the history
Pull-Request: #4698.
  • Loading branch information
maqi authored Oct 26, 2023
1 parent e89a11b commit 357ed40
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
2 changes: 2 additions & 0 deletions protocols/kad/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
See [PR 4503](https://github.com/libp2p/rust-libp2p/pull/4503).
- Make previously "deprecated" `record` module private.
See [PR 4035](https://github.com/libp2p/rust-libp2p/pull/4035).
- Expose hashed bytes of KBucketKey.
See [PR 4698](https://github.com/libp2p/rust-libp2p/pull/4698).
- Remove previously deprecated type-aliases.
Users should follow the convention of importing the `libp2p::kad` module and referring to symbols as `kad::Behaviour` etc.
See [PR 4733](https://github.com/libp2p/rust-libp2p/pull/4733).
Expand Down
5 changes: 5 additions & 0 deletions protocols/kad/src/kbucket/key.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,11 @@ impl<T> Key<T> {
self.bytes.distance(other)
}

/// Exposing the hashed bytes.
pub fn hashed_bytes(&self) -> &[u8] {
&self.bytes.0
}

/// Returns the uniquely determined key with the given distance to `self`.
///
/// This implements the following equivalence:
Expand Down

0 comments on commit 357ed40

Please sign in to comment.