[][src]Trait addr_hal::SocketAddressV4

pub trait SocketAddressV4: Clone + Copy {
    type IpAddress: Ipv4Address;
    fn new(ip: Ipv4Addr<Self::IpAddress>, port: u16) -> Self;
fn ip(&self) -> &Ipv4Addr<Self::IpAddress>;
fn set_ip(&mut self, ip: Ipv4Addr<Self::IpAddress>);
fn port(&self) -> u16;
fn set_port(&mut self, port: u16); }

Describe the internal data structure behavior of SocketAddrV4.

You can implement this trait by yourself or use ffi for specific Platform.

Associated Types

type IpAddress: Ipv4Address

Ipv4Address inner type.

Loading content...

Required methods

fn new(ip: Ipv4Addr<Self::IpAddress>, port: u16) -> Self

Creates a new IPv4 address from ip address and port

The result will represent the Socket address ip:port.

fn ip(&self) -> &Ipv4Addr<Self::IpAddress>

Got ip address.

fn set_ip(&mut self, ip: Ipv4Addr<Self::IpAddress>)

Set ip address.

fn port(&self) -> u16

Got port.

fn set_port(&mut self, port: u16)

Set port.

Loading content...

Implementors

Loading content...