Struct socket_addr::SocketAddrV4 [] [src]

pub struct SocketAddrV4(pub SocketAddrV4);

Utility struct of SocketAddrV4 for hole punching

Methods from Deref<Target = SocketAddrV4>

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));

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]

Formats the value using the given formatter.

impl PartialEq for SocketAddrV4
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for SocketAddrV4
[src]

impl Hash for SocketAddrV4
[src]

Feeds this value into the given [Hasher]. Read more

Feeds a slice of this type into the given [Hasher]. Read more

impl Clone for SocketAddrV4
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl Copy for SocketAddrV4
[src]

impl Deref for SocketAddrV4
[src]

The resulting type after dereferencing

The method called to dereference a value

impl Encodable for SocketAddrV4
[src]

Serialize a value using an Encoder.

impl Decodable for SocketAddrV4
[src]

Deserialize a value using a Decoder.