pub struct KnownPeers(/* private fields */);Implementations§
Source§impl KnownPeers
impl KnownPeers
pub fn new() -> Self
pub fn contains(&self, peer_id: &PeerId) -> bool
pub fn is_banned(&self, peer_id: &PeerId) -> bool
pub fn get(&self, peer_id: &PeerId) -> Option<Arc<PeerInfo>>
pub fn get_affinity(&self, peer_id: &PeerId) -> Option<PeerAffinity>
pub fn remove(&self, peer_id: &PeerId)
pub fn ban(&self, peer_id: &PeerId)
pub fn make_handle( &self, peer_id: &PeerId, with_affinity: bool, ) -> Option<KnownPeerHandle>
Sourcepub fn insert(
&self,
peer_info: Arc<PeerInfo>,
with_affinity: bool,
) -> Result<KnownPeerHandle, KnownPeersError>
pub fn insert( &self, peer_info: Arc<PeerInfo>, with_affinity: bool, ) -> Result<KnownPeerHandle, KnownPeersError>
Inserts a new handle only if the provided info is not outdated and the peer is not banned.
Sourcepub fn insert_allow_outdated(
&self,
peer_info: Arc<PeerInfo>,
with_affinity: bool,
) -> Result<KnownPeerHandle, PeerBannedError>
pub fn insert_allow_outdated( &self, peer_info: Arc<PeerInfo>, with_affinity: bool, ) -> Result<KnownPeerHandle, PeerBannedError>
Same as KnownPeers::insert, but ignores outdated info.
Trait Implementations§
Source§impl Clone for KnownPeers
impl Clone for KnownPeers
Source§fn clone(&self) -> KnownPeers
fn clone(&self) -> KnownPeers
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Default for KnownPeers
impl Default for KnownPeers
Source§fn default() -> KnownPeers
fn default() -> KnownPeers
Returns the “default value” for a type. Read more
Auto Trait Implementations§
impl Freeze for KnownPeers
impl !RefUnwindSafe for KnownPeers
impl Send for KnownPeers
impl Sync for KnownPeers
impl Unpin for KnownPeers
impl !UnwindSafe for KnownPeers
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> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
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