pub struct Bucket {
entries: Vec<BucketEntry>,
}
Expand description
A Bucket represents a group of entries in the routing table.
Fields§
§entries: Vec<BucketEntry>
Implementations§
Source§impl Bucket
impl Bucket
Sourcepub fn iter(&self) -> impl Iterator<Item = &BucketEntry>
pub fn iter(&self) -> impl Iterator<Item = &BucketEntry>
Returns an iterator over the entries in the bucket.
Sourcepub fn random_iter(&self, amount: usize) -> impl Iterator<Item = &BucketEntry>
pub fn random_iter(&self, amount: usize) -> impl Iterator<Item = &BucketEntry>
Returns an iterator of entries in random order.
Sourcepub fn update_entry(&mut self, key: &[u8; 32], entry_flag: u16)
pub fn update_entry(&mut self, key: &[u8; 32], entry_flag: u16)
Updates the status of an entry in the bucket identified by the given key.
If the key is not found in the bucket, no action is taken.
This will also update the last_seen field and increase the failures counter for the bucket entry according to the new status.
Sourcepub fn contains_key(&self, key: &[u8; 32]) -> bool
pub fn contains_key(&self, key: &[u8; 32]) -> bool
Check if the bucket contains the given key.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Bucket
impl RefUnwindSafe for Bucket
impl Send for Bucket
impl Sync for Bucket
impl Unpin for Bucket
impl UnwindSafe for Bucket
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more