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

pub struct KBucketsTable<Id, Val> { /* fields omitted */ }

Table of k-buckets.

Methods

impl<Id, Val> KBucketsTable<Id, Val> where
    Id: KBucketsPeerId
[src]

pub fn new(my_id: Id, ping_timeout: Duration) -> Self
[src]

Builds a new routing table.

Important traits for BucketsIter<'a, Id, Val>
pub fn buckets(&mut self) -> BucketsIter<Id, Val>
[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 my_id(&self) -> &Id
[src]

Returns the ID of the local node.

pub fn find_closest(&mut self, id: &Id) -> VecIntoIter<Id> where
    Id: Clone
[src]

Finds the num nodes closest to id, ordered by distance.

pub fn find_closest_with_self(&mut self, id: &Id) -> VecIntoIter<Id> where
    Id: Clone
[src]

Same as find_closest, but includes the local peer as well.

pub fn update(&mut self, id: Id, value: Val) -> UpdateOutcome<Id, Val>
[src]

Marks the node as "most recent" in its bucket and modifies the value associated to it. This function should be called whenever we receive a communication from a node.

Trait Implementations

impl<Id: Clone, Val: Clone> Clone for KBucketsTable<Id, Val>
[src]

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

Performs copy-assignment from source. Read more

impl<Id: Debug, Val: Debug> Debug for KBucketsTable<Id, Val>
[src]

Auto Trait Implementations

impl<Id, Val> Send for KBucketsTable<Id, Val> where
    Id: Send,
    Val: Send

impl<Id, Val> Sync for KBucketsTable<Id, Val> where
    Id: Sync,
    Val: Sync

Blanket Implementations

impl<T> From for T
[src]

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

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

type Owned = T

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

type Error = !

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

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

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

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

🔬 This is a nightly-only experimental API. (try_from)

The type returned in the event of a conversion error.

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

impl<T> Same for T

type Output = T

Should always be Self

impl<T> Erased for T