Struct everscale_network::utils::PeersCache
source · [−]pub struct PeersCache { /* private fields */ }Implementations
sourceimpl PeersCache
impl PeersCache
pub fn with_capacity(capacity: usize) -> Self
pub fn version(&self) -> u64
pub fn contains(&self, peer: &AdnlNodeIdShort) -> bool
pub fn get(&self, index: usize) -> Option<AdnlNodeIdShort>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn iter(&self) -> PeersCacheIter<'_>ⓘNotable traits for PeersCacheIter<'a>impl<'a> Iterator for PeersCacheIter<'a> type Item = &'a AdnlNodeIdShort;
pub fn get_random_peers(
&self,
amount: usize,
except: Option<&AdnlNodeIdShort>
) -> Vec<AdnlNodeIdShort>
sourcepub fn randomly_fill_from(
&self,
other: &PeersCache,
amount: usize,
except: Option<&FxDashSet<AdnlNodeIdShort>>
)
pub fn randomly_fill_from(
&self,
other: &PeersCache,
amount: usize,
except: Option<&FxDashSet<AdnlNodeIdShort>>
)
NOTE: will deadlock if other is the same as self
pub fn put(&self, peer_id: AdnlNodeIdShort) -> bool
pub fn extend<I>(&self, peers: I) where
I: IntoIterator<Item = AdnlNodeIdShort>,
Trait Implementations
sourceimpl IntoIterator for PeersCache
impl IntoIterator for PeersCache
type Item = AdnlNodeIdShort
type Item = AdnlNodeIdShort
The type of the elements being iterated over.
type IntoIter = IntoIter<AdnlNodeIdShort, Global>
type IntoIter = IntoIter<AdnlNodeIdShort, Global>
Which kind of iterator are we turning this into?
sourceimpl<'a> IntoIterator for &'a PeersCache
impl<'a> IntoIterator for &'a PeersCache
type Item = &'a AdnlNodeIdShort
type Item = &'a AdnlNodeIdShort
The type of the elements being iterated over.
type IntoIter = PeersCacheIter<'a>
type IntoIter = PeersCacheIter<'a>
Which kind of iterator are we turning this into?
Auto Trait Implementations
impl !RefUnwindSafe for PeersCache
impl Send for PeersCache
impl Sync for PeersCache
impl Unpin for PeersCache
impl UnwindSafe for PeersCache
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
sourceimpl<Choices> CoproductSubsetter<CNil, HNil> for Choices
impl<Choices> CoproductSubsetter<CNil, HNil> for Choices
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
fn vzip(self) -> V
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber to this type, returning a
WithDispatch wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber to this type, returning a
WithDispatch wrapper. Read more