pub struct PrivateOverlayEntries { /* private fields */ }Implementations§
Source§impl PrivateOverlayEntries
impl PrivateOverlayEntries
Sourcepub fn subscribe(&self) -> Receiver<PrivateOverlayEntriesEvent>
pub fn subscribe(&self) -> Receiver<PrivateOverlayEntriesEvent>
Subscribes to the set updates.
Sourcepub fn iter(&self) -> Values<'_, PeerId, PrivateOverlayEntryData>
pub fn iter(&self) -> Values<'_, PeerId, PrivateOverlayEntryData>
Returns an iterator over the entry ids.
The order is not random, but is not defined.
Sourcepub fn choose<R>(&self, rng: &mut R) -> Option<&PrivateOverlayEntryData>
pub fn choose<R>(&self, rng: &mut R) -> Option<&PrivateOverlayEntryData>
Returns one random peer, or None if set is empty.
Sourcepub fn choose_multiple<R>(
&self,
rng: &mut R,
n: usize,
) -> ChooseMultiplePrivateOverlayEntries<'_> ⓘ
pub fn choose_multiple<R>( &self, rng: &mut R, n: usize, ) -> ChooseMultiplePrivateOverlayEntries<'_> ⓘ
Chooses n entries from the set, without repetition,
and in random order.
Sourcepub fn len(&self) -> usize
pub fn len(&self) -> usize
Returns the number of elements in the set, also referred to as its ‘length’.
Sourcepub fn contains(&self, peer_id: &PeerId) -> bool
pub fn contains(&self, peer_id: &PeerId) -> bool
Returns true if the set contains the specified peer id.
Sourcepub fn get_handle(&self, peer_id: &PeerId) -> Option<&PeerResolverHandle>
pub fn get_handle(&self, peer_id: &PeerId) -> Option<&PeerResolverHandle>
Returns the peer resolver handle for the specified peer id, if it exists.
Auto Trait Implementations§
impl Freeze for PrivateOverlayEntries
impl !RefUnwindSafe for PrivateOverlayEntries
impl Send for PrivateOverlayEntries
impl Sync for PrivateOverlayEntries
impl Unpin for PrivateOverlayEntries
impl !UnwindSafe for PrivateOverlayEntries
Blanket Implementations§
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
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more