Trait xstack_kad::kbucket::KBucketKey
source · pub trait KBucketKey {
type Length: ArrayLength;
type Distance: KBucketDistance;
// Required methods
fn distance(&self, rhs: &Self) -> Self::Distance
where Self: Sized;
fn longest_common_prefix(&self, rhs: &Self) -> usize
where Self: Sized;
fn for_distance(&self, distance: Self::Distance) -> Self;
}Expand description
A key type trait used for KBucketTable
Required Associated Types§
type Length: ArrayLength
type Distance: KBucketDistance
Required Methods§
sourcefn distance(&self, rhs: &Self) -> Self::Distancewhere
Self: Sized,
fn distance(&self, rhs: &Self) -> Self::Distancewhere
Self: Sized,
Calculate the distance between two keys.
sourcefn longest_common_prefix(&self, rhs: &Self) -> usizewhere
Self: Sized,
fn longest_common_prefix(&self, rhs: &Self) -> usizewhere
Self: Sized,
Returns the uniquely determined key with the given distance to self.
This implements the following equivalence:
self xor other = distance <==> other = self xor distance
sourcefn for_distance(&self, distance: Self::Distance) -> Self
fn for_distance(&self, distance: Self::Distance) -> Self
Returns the longest common prefix length with rhs.
Object Safety§
This trait is not object safe.