Struct no_std_net::SocketAddrV4
[−]
[src]
pub struct SocketAddrV4 { /* fields omitted */ }
An IPv4 socket address.
IPv4 socket addresses consist of an IPv4 address and a 16-bit port number, as stated in IETF RFC 793.
See SocketAddr
for a type encompassing both IPv4 and IPv6 socket addresses.
Examples
use std::net::{Ipv4Addr, SocketAddrV4}; let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080); assert_eq!("127.0.0.1:8080".parse(), Ok(socket)); assert_eq!(socket.ip(), &Ipv4Addr::new(127, 0, 0, 1)); assert_eq!(socket.port(), 8080);
Methods
impl SocketAddrV4
[src]
pub fn new(ip: Ipv4Addr, port: u16) -> SocketAddrV4
[src]
Creates a new socket address from an IPv4 address and a port number.
Examples
use std::net::{SocketAddrV4, Ipv4Addr}; let socket = SocketAddrV4::new(Ipv4Addr::new(127, 0, 0, 1), 8080);
Trait Implementations
impl Copy for SocketAddrV4
[src]
impl Clone for SocketAddrV4
[src]
fn clone(&self) -> SocketAddrV4
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more
impl PartialEq for SocketAddrV4
[src]
fn eq(&self, __arg_0: &SocketAddrV4) -> bool
[src]
This method tests for self
and other
values to be equal, and is used by ==
. Read more
fn ne(&self, __arg_0: &SocketAddrV4) -> bool
[src]
This method tests for !=
.
impl Eq for SocketAddrV4
[src]
impl Hash for SocketAddrV4
[src]
fn hash<__H: Hasher>(&self, __arg_0: &mut __H)
[src]
Feeds this value into the given [Hasher
]. Read more
fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
Feeds a slice of this type into the given [Hasher
]. Read more
impl Debug for SocketAddrV4
[src]
fn fmt(&self, __arg_0: &mut Formatter) -> Result
[src]
Formats the value using the given formatter. Read more