pub struct PublicOverlayEntries { /* private fields */ }Implementations§
Source§impl PublicOverlayEntries
impl PublicOverlayEntries
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 iter(&self) -> Values<'_, PeerId, PublicOverlayEntryData>
pub fn iter(&self) -> Values<'_, PeerId, PublicOverlayEntryData>
Returns an iterator over the entries.
The order is not random, but is not defined.
Sourcepub fn choose<R>(&self, rng: &mut R) -> Option<&PublicOverlayEntryData>
pub fn choose<R>(&self, rng: &mut R) -> Option<&PublicOverlayEntryData>
Returns a reference to one random element of the slice,
or None if the slice is empty.
Sourcepub fn choose_multiple<R>(
&self,
rng: &mut R,
n: usize,
) -> ChooseMultiplePublicOverlayEntries<'_> ⓘ
pub fn choose_multiple<R>( &self, rng: &mut R, n: usize, ) -> ChooseMultiplePublicOverlayEntries<'_> ⓘ
Chooses n entries from the set, without repetition,
and in random order.
Sourcepub fn choose_all<R>(
&self,
rng: &mut R,
) -> ChooseMultiplePublicOverlayEntries<'_> ⓘ
pub fn choose_all<R>( &self, rng: &mut R, ) -> ChooseMultiplePublicOverlayEntries<'_> ⓘ
Chooses all entries from the set, without repetition, and in random order.
Auto Trait Implementations§
impl Freeze for PublicOverlayEntries
impl !RefUnwindSafe for PublicOverlayEntries
impl Send for PublicOverlayEntries
impl Sync for PublicOverlayEntries
impl Unpin for PublicOverlayEntries
impl !UnwindSafe for PublicOverlayEntries
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