pub struct StaticPeerAddr { /* private fields */ }
Expand description
Helper for when the peer’s address is known. Always returns the given address, if any.
Implementations§
Source§impl StaticPeerAddr
impl StaticPeerAddr
Sourcepub fn new(address: Address, address_type: AddressType) -> Self
pub fn new(address: Address, address_type: AddressType) -> Self
Returns a StaticPeerAddr
that always returns the given address,
regardless of the peer_id
being looked up.
Sourcepub fn new_for_peer(
peer_id: PeerId,
address: Address,
address_type: AddressType,
) -> Self
pub fn new_for_peer( peer_id: PeerId, address: Address, address_type: AddressType, ) -> Self
Returns a StaticPeerAddr
that will only return successfully if the
peer_id
matches.
Trait Implementations§
Source§impl GetPeerAddr for StaticPeerAddr
impl GetPeerAddr for StaticPeerAddr
Source§async fn get_peer_address(
&self,
peer_id: PeerId,
) -> Result<(Address, AddressType)>
async fn get_peer_address( &self, peer_id: PeerId, ) -> Result<(Address, AddressType)>
Resolve peer ID to peer address and address type.
Auto Trait Implementations§
impl Freeze for StaticPeerAddr
impl RefUnwindSafe for StaticPeerAddr
impl Send for StaticPeerAddr
impl Sync for StaticPeerAddr
impl Unpin for StaticPeerAddr
impl UnwindSafe for StaticPeerAddr
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