pub struct PeersSet { /* private fields */ }Expand description
A set of unique short node ids
Implementations§
Source§impl PeersSet
impl PeersSet
Sourcepub fn with_capacity(capacity: u32) -> Self
pub fn with_capacity(capacity: u32) -> Self
Constructs new peers set with the specified fixed capacity
Sourcepub fn with_peers_and_capacity(peers: &[NodeIdShort], capacity: u32) -> Self
pub fn with_peers_and_capacity(peers: &[NodeIdShort], capacity: u32) -> Self
Constructs new peers set with some initial peers
NOTE: Only first capacity peers will be added
pub fn version(&self) -> u64
pub fn contains(&self, peer: &NodeIdShort) -> bool
pub fn get(&self, index: usize) -> Option<NodeIdShort>
pub fn len(&self) -> usize
pub fn is_empty(&self) -> bool
pub fn is_full(&self) -> bool
pub fn iter(&self) -> Iter<'_>
pub fn get_random_peers( &self, amount: u32, except: Option<&NodeIdShort>, ) -> Vec<NodeIdShort>
pub fn randomly_fill_from( &self, other: &PeersSet, amount: u32, except: Option<&DashSet<NodeIdShort, RandomState>>, )
Sourcepub fn insert(&self, peer_id: NodeIdShort) -> bool
pub fn insert(&self, peer_id: NodeIdShort) -> bool
Adds a value to the set.
If the set did not have this value present, true is returned.
pub fn extend<I>(&self, peers: I)where
I: IntoIterator<Item = NodeIdShort>,
Sourcepub fn clone_inner(&self) -> Vec<NodeIdShort>
pub fn clone_inner(&self) -> Vec<NodeIdShort>
Clones internal node ids storage
Trait Implementations§
Source§impl<'a> IntoIterator for &'a PeersSet
impl<'a> IntoIterator for &'a PeersSet
Auto Trait Implementations§
impl !Freeze for PeersSet
impl !RefUnwindSafe for PeersSet
impl Send for PeersSet
impl Sync for PeersSet
impl Unpin for PeersSet
impl UnwindSafe for PeersSet
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