Struct socket_addr::SocketAddrV4
[−]
[src]
pub struct SocketAddrV4(pub SocketAddrV4);
Utility struct of SocketAddrV4
for hole punching
Methods from Deref<Target = SocketAddrV4>
fn ip(&self) -> &Ipv4Addr
1.0.0
Returns the IP address associated with this socket address.
Examples
use std::net::{SocketAddrV4, Ipv4Addr}; let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080); assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1));
fn port(&self) -> u16
1.0.0
Returns the port number associated with this socket address.
Examples
use std::net::{SocketAddrV4, Ipv4Addr}; let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080); assert_eq!(socket.port(), 8080);
Trait Implementations
impl Debug for SocketAddrV4
[src]
impl PartialEq for SocketAddrV4
[src]
fn eq(&self, __arg_0: &SocketAddrV4) -> bool
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SocketAddrV4) -> bool
This method tests for !=
.
impl Eq for SocketAddrV4
[src]
impl Hash for SocketAddrV4
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Clone for SocketAddrV4
[src]
fn clone(&self) -> SocketAddrV4
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0
Performs copy-assignment from source
. Read more
impl Copy for SocketAddrV4
[src]
impl Deref for SocketAddrV4
[src]
type Target = SocketAddrV4
The resulting type after dereferencing
fn deref(&self) -> &SocketAddrV4
The method called to dereference a value
impl Encodable for SocketAddrV4
[src]
impl Decodable for SocketAddrV4
[src]
fn decode<D: Decoder>(d: &mut D) -> Result<SocketAddrV4, D::Error>
Deserialize a value using a Decoder
.