pub struct PeerCandidates { /* private fields */ }Expand description
A peer’s aggregated, family-tagged, de-duplicated candidate addresses.
Addresses are kept in insertion (discovery) order within each family so the caller’s source ordering is preserved; a duplicate address keeps the FIRST source it was seen from.
Implementations§
Source§impl PeerCandidates
impl PeerCandidates
Sourcepub fn new() -> PeerCandidates
pub fn new() -> PeerCandidates
An empty candidate set.
Sourcepub fn add(&mut self, addr: SocketAddr, source: CandidateSource) -> bool
pub fn add(&mut self, addr: SocketAddr, source: CandidateSource) -> bool
Add one discovered address (family derived, deduplicated). Returns true if it was new.
Sourcepub fn extend<I>(&mut self, addrs: I, source: CandidateSource)where
I: IntoIterator<Item = SocketAddr>,
pub fn extend<I>(&mut self, addrs: I, source: CandidateSource)where
I: IntoIterator<Item = SocketAddr>,
Add many addresses from one discovery source (dedup applies).
Sourcepub fn families(&self) -> BTreeSet<Family>
pub fn families(&self) -> BTreeSet<Family>
The families this peer offers at least one candidate on.
Sourcepub fn of_family(&self, family: Family) -> impl Iterator<Item = SocketAddr> + '_
pub fn of_family(&self, family: Family) -> impl Iterator<Item = SocketAddr> + '_
The candidate addresses of family, in discovery order.
Trait Implementations§
Source§impl Clone for PeerCandidates
impl Clone for PeerCandidates
Source§fn clone(&self) -> PeerCandidates
fn clone(&self) -> PeerCandidates
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for PeerCandidates
impl Debug for PeerCandidates
Source§impl Default for PeerCandidates
impl Default for PeerCandidates
Source§fn default() -> PeerCandidates
fn default() -> PeerCandidates
Returns the “default value” for a type. Read more
impl Eq for PeerCandidates
Source§impl PartialEq for PeerCandidates
impl PartialEq for PeerCandidates
impl StructuralPartialEq for PeerCandidates
Auto Trait Implementations§
impl Freeze for PeerCandidates
impl RefUnwindSafe for PeerCandidates
impl Send for PeerCandidates
impl Sync for PeerCandidates
impl Unpin for PeerCandidates
impl UnsafeUnpin for PeerCandidates
impl UnwindSafe for PeerCandidates
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