Struct everscale_network::adnl::PeersSet
source · 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