Struct xstack_kad::KBucketDistance
source · pub struct KBucketDistance(/* private fields */);
Expand description
The distance type outlined in the Kademlia paper
Implementations§
source§impl KBucketDistance
impl KBucketDistance
sourcepub fn k_index(&self) -> Option<u32>
pub fn k_index(&self) -> Option<u32>
Returns the integer part of the base 2 logarithm of the KBucketDistance
.
Returns None
if the distance is zero.
Trait Implementations§
source§impl Debug for KBucketDistance
impl Debug for KBucketDistance
source§impl Display for KBucketDistance
impl Display for KBucketDistance
source§impl Hash for KBucketDistance
impl Hash for KBucketDistance
source§impl Ord for KBucketDistance
impl Ord for KBucketDistance
source§fn cmp(&self, other: &KBucketDistance) -> Ordering
fn cmp(&self, other: &KBucketDistance) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq for KBucketDistance
impl PartialEq for KBucketDistance
source§impl PartialOrd for KBucketDistance
impl PartialOrd for KBucketDistance
impl Eq for KBucketDistance
impl StructuralPartialEq for KBucketDistance
Auto Trait Implementations§
impl Freeze for KBucketDistance
impl RefUnwindSafe for KBucketDistance
impl Send for KBucketDistance
impl Sync for KBucketDistance
impl Unpin for KBucketDistance
impl UnwindSafe for KBucketDistance
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more