[][src]Struct libp2p_kad::kbucket::KeyBytes

pub struct KeyBytes(_);

The raw bytes of a key in the DHT keyspace.

Methods

impl KeyBytes[src]

pub fn new<T>(value: T) -> Self where
    T: AsRef<[u8]>, 
[src]

Creates a new key in the DHT keyspace by running the given value through a random oracle.

pub fn distance<U>(&self, other: &U) -> Distance where
    U: AsRef<KeyBytes>, 
[src]

Computes the distance of the keys according to the XOR metric.

pub fn for_distance(&self, d: Distance) -> KeyBytes[src]

Returns the uniquely determined key with the given distance to self.

This implements the following equivalence:

self xor other = distance <==> other = self xor distance

Trait Implementations

impl<TKey: AsRef<KeyBytes>, TVal> AsRef<KeyBytes> for EntryView<TKey, TVal>[src]

impl<T> AsRef<KeyBytes> for Key<T>[src]

impl AsRef<KeyBytes> for KeyBytes[src]

impl Clone for KeyBytes[src]

impl Debug for KeyBytes[src]

impl Eq for KeyBytes[src]

impl<T> Into<KeyBytes> for Key<T>[src]

impl PartialEq<KeyBytes> for KeyBytes[src]

impl StructuralEq for KeyBytes[src]

impl StructuralPartialEq for KeyBytes[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,