Struct libp2p_kad::kbucket::KeyBytes [−][src]
The raw bytes of a key in the DHT keyspace.
Implementations
impl KeyBytes
[src]
pub fn new<T>(value: T) -> Self where
T: Borrow<[u8]>,
[src]
T: Borrow<[u8]>,
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]
U: AsRef<KeyBytes>,
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
impl RefUnwindSafe for KeyBytes
impl Send for KeyBytes
impl Sync for KeyBytes
impl Unpin for KeyBytes
impl UnwindSafe for KeyBytes
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
[src]
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
[src]
V: MultiLane<T>,