Struct PeerRecord
pub struct PeerRecord<T> { /* private fields */ }
Available on crate feature
peer-store
only.Expand description
Internal record of MemoryStore
.
Implementations§
§impl<T> PeerRecord<T>
impl<T> PeerRecord<T>
pub fn addresses(&self) -> impl Iterator<Item = &Multiaddr>
pub fn addresses(&self) -> impl Iterator<Item = &Multiaddr>
Iterate over all addresses. More recently-used address comes first. Does not change the order.
pub fn update_address(&mut self, address: &Multiaddr) -> bool
pub fn update_address(&mut self, address: &Multiaddr) -> bool
Update the address in the LRU cache, promote it to the front if it exists, insert it to the front if not. Returns true when the address is new.
pub fn remove_address(&mut self, address: &Multiaddr) -> bool
pub fn remove_address(&mut self, address: &Multiaddr) -> bool
Remove the address in the LRU cache regardless of its position. Returns true when the address is removed, false when not exist.
pub fn get_custom_data(&self) -> Option<&T>
pub fn take_custom_data(&mut self) -> Option<T>
pub fn insert_custom_data(&mut self, custom_data: T)
Trait Implementations§
§impl<T> Clone for PeerRecord<T>where
T: Clone,
impl<T> Clone for PeerRecord<T>where
T: Clone,
§fn clone(&self) -> PeerRecord<T>
fn clone(&self) -> PeerRecord<T>
Returns a copy 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 moreAuto Trait Implementations§
impl<T> Freeze for PeerRecord<T>where
T: Freeze,
impl<T> RefUnwindSafe for PeerRecord<T>where
T: RefUnwindSafe,
impl<T> Send for PeerRecord<T>where
T: Send,
impl<T> Sync for PeerRecord<T>where
T: Sync,
impl<T> Unpin for PeerRecord<T>where
T: Unpin,
impl<T> UnwindSafe for PeerRecord<T>where
T: UnwindSafe,
Blanket Implementations§
§impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedExplicit<'a, E> for Twhere
T: 'a,
§impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
impl<'a, T, E> AsTaggedImplicit<'a, E> for Twhere
T: 'a,
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,
§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> 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