[−][src]Trait libp2p_kad::kbucket::KBucketsPeerId
Trait that must be implemented on types that can be used as an identifier in a k-bucket.
If TOther
is not the same as Self
, it represents an entry already in the k-buckets that
Self
can compare against.
Required methods
fn distance_with(&self, other: &TOther) -> u32
Computes the XOR of this value and another one. The lower the closer.
fn max_distance() -> NonZeroUsize
Returns then number of bits that are necessary to store the distance between peer IDs. Used for pre-allocations.
Implementations on Foreign Types
impl KBucketsPeerId<PeerId> for PeerId
[src]
fn distance_with(&self, other: &Self) -> u32
[src]
fn max_distance() -> NonZeroUsize
[src]
impl KBucketsPeerId<PeerId> for Multihash
[src]
fn distance_with(&self, other: &PeerId) -> u32
[src]
fn max_distance() -> NonZeroUsize
[src]
impl KBucketsPeerId<Multihash> for Multihash
[src]
fn distance_with(&self, other: &Self) -> u32
[src]
fn max_distance() -> NonZeroUsize
[src]
impl<A, B> KBucketsPeerId<(A, B)> for (A, B) where
A: KBucketsPeerId + PartialEq,
B: KBucketsPeerId + PartialEq,
[src]
A: KBucketsPeerId + PartialEq,
B: KBucketsPeerId + PartialEq,
fn distance_with(&self, other: &(A, B)) -> u32
[src]
fn max_distance() -> NonZeroUsize
[src]
impl<'a, T> KBucketsPeerId<&'a T> for &'a T where
T: KBucketsPeerId,
[src]
T: KBucketsPeerId,