[][src]Struct libp2p_kad::kbucket::KBucketsTable

pub struct KBucketsTable<TPeerId, TVal> { /* fields omitted */ }

Table of k-buckets.

Methods

impl<TPeerId, TVal> KBucketsTable<TPeerId, TVal> where
    TPeerId: KBucketsPeerId + Clone
[src]

pub fn new(my_id: TPeerId, unresponsive_timeout: Duration) -> Self[src]

Builds a new routing table.

pub fn my_id(&self) -> &TPeerId[src]

Returns the ID of the local node.

pub fn entry<'a>(&'a mut self, peer_id: &'a TPeerId) -> Entry<'a, TPeerId, TVal>[src]

Returns an object containing the state of the given entry.

pub fn entries_not_pending(&self) -> impl Iterator<Item = (&TPeerId, &TVal)>[src]

Returns an iterator to all the peer IDs in the bucket, without the pending nodes.

Important traits for BucketsIter<'a, TPeerId, TVal>
pub fn buckets(&mut self) -> BucketsIter<TPeerId, TVal>[src]

Returns an iterator to all the buckets of this table.

Ordered by proximity to the local node. Closest bucket (with max. one node in it) comes first.

pub fn find_closest(
    &mut self,
    id: &impl KBucketsPeerId<TPeerId>
) -> VecIntoIter<TPeerId>
[src]

Finds the nodes closest to id, ordered by distance.

Pending nodes are ignored.

Trait Implementations

impl<TPeerId: Clone, TVal: Clone> Clone for KBucketsTable<TPeerId, TVal>[src]

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<TPeerId: Debug, TVal: Debug> Debug for KBucketsTable<TPeerId, TVal>[src]

Auto Trait Implementations

impl<TPeerId, TVal> Send for KBucketsTable<TPeerId, TVal> where
    TPeerId: Send,
    TVal: Send

impl<TPeerId, TVal> Sync for KBucketsTable<TPeerId, TVal> where
    TPeerId: Sync,
    TVal: Sync

Blanket Implementations

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

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

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<T> BorrowMut<T> for T where
    T: ?Sized
[src]

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

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

impl<T> Same<T> for T

type Output = T

Should always be Self

impl<T> Erased for T