pub struct PeerAddr { /* private fields */ }
Expand description
Represents a peer’s address information.
§Fields
tcp
: ASocketAddr
representing the peer’s data transfer address.udp
: An optionalSocketAddr
representing the peer’s discover address.None
if the peer is directly connecting to us or the port is the same totcp
’s
Implementations§
Source§impl PeerAddr
impl PeerAddr
Sourcepub const fn tcp(&self) -> SocketAddr
pub const fn tcp(&self) -> SocketAddr
Returns the peer’s TCP address.
Sourcepub const fn udp(&self) -> Option<SocketAddr>
pub const fn udp(&self) -> Option<SocketAddr>
Returns the peer’s UDP address.
Sourcepub const fn new(tcp: SocketAddr, udp: Option<SocketAddr>) -> Self
pub const fn new(tcp: SocketAddr, udp: Option<SocketAddr>) -> Self
Returns a new PeerAddr
with the given tcp
and udp
addresses.
Sourcepub const fn from_tcp(tcp: SocketAddr) -> Self
pub const fn from_tcp(tcp: SocketAddr) -> Self
Returns a new PeerAddr
with a tcp
address only.
Trait Implementations§
impl Copy for PeerAddr
impl Eq for PeerAddr
impl StructuralPartialEq for PeerAddr
Auto Trait Implementations§
impl Freeze for PeerAddr
impl RefUnwindSafe for PeerAddr
impl Send for PeerAddr
impl Sync for PeerAddr
impl Unpin for PeerAddr
impl UnwindSafe for PeerAddr
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,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key
and return true
if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
§impl<T> WithSubscriber for T
impl<T> WithSubscriber for T
§fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>where
S: Into<Dispatch>,
§fn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
impl<T> ErasedDestructor for Twhere
T: 'static,
impl<T> MaybeSendSync for T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 64 bytes