[−][src]Struct libp2p_kad::Addresses
A non-empty list of (unique) addresses of a peer in the routing table.
Implementations
impl Addresses
[src]
pub fn new(addr: Multiaddr) -> Addresses
[src]
Creates a new list of addresses.
pub fn first(&self) -> &Multiaddr
[src]
Gets a reference to the first address in the list.
pub fn iter(&self) -> impl Iterator<Item = &Multiaddr>
[src]
Returns an iterator over the addresses.
pub fn len(&self) -> usize
[src]
Returns the number of addresses in the list.
pub fn into_vec(self) -> Vec<Multiaddr>
[src]
Converts the addresses into a Vec
.
pub fn remove(&mut self, addr: &Multiaddr) -> Result<(), ()>
[src]
Removes the given address from the list.
Returns Ok(())
if the address is either not in the list or was found and
removed. Returns Err(())
if the address is the last remaining address,
which cannot be removed.
An address should only be removed if is determined to be invalid or otherwise unreachable.
pub fn insert(&mut self, addr: Multiaddr) -> bool
[src]
Adds a new address to the end of the list.
Returns true if the address was added, false otherwise (i.e. if the address is already in the list).
pub fn replace(&mut self, old: &Multiaddr, new: &Multiaddr) -> bool
[src]
Replaces an old address with a new address.
Returns true if the previous address was found and replaced with a clone of the new address, returns false otherwise.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for Addresses
impl Send for Addresses
impl Sync for Addresses
impl Unpin for Addresses
impl UnwindSafe for Addresses
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> Same<T> for T
type Output = T
Should always be Self
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,