[−][src]Struct libp2p_kad::kbucket::KBucketsTable
Table of k-buckets.
Methods
impl<TPeerId, TVal> KBucketsTable<TPeerId, TVal> where
TPeerId: KBucketsPeerId + Clone,
[src]
TPeerId: KBucketsPeerId + Clone,
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]
ⓘImportant traits for BucketsIter<'a, TPeerId, TVal>
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]
&mut self,
id: &impl KBucketsPeerId<TPeerId>
) -> VecIntoIter<TPeerId>
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(&self) -> 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,
TPeerId: Send,
TVal: Send,
impl<TPeerId, TVal> Sync for KBucketsTable<TPeerId, TVal> where
TPeerId: Sync,
TVal: Sync,
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]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
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.
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.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Same<T> for T
type Output = T
Should always be Self