std.net.socket.SocketAddress
class pub SocketAddress
An IPv4 or IPv6 socket address.
Fields
address
let pub @address: String
The IPv4/IPv6 address of this socket address.
This is stored as a String
so we don't need to parse the address every
time a SocketAddress
is created.
port
let pub @port: Int
The port number of this socket address.
Static methods
new
Show source codeHide source code
fn pub static new(address: String, port: Int) -> SocketAddress {
SocketAddress(address: address, port: port)
}
fn pub static new(address: String, port: Int) -> SocketAddress
Instance methods
!=
Show source codeHide source code
fn pub !=(other: T) -> Bool {
(self == other).false?
}
fn pub !=(other: T) -> Bool
Returns true
if self
and the given object are not equal to each other.
==
Show source codeHide source code
fn pub ==(other: ref SocketAddress) -> Bool {
@address == other.address and @port == other.port
}
fn pub ==(other: ref SocketAddress) -> Bool
Returns true
if self
and other
are the same.
fmt
Show source codeHide source code
fn pub fmt(formatter: mut Formatter) {
formatter.write('${@address}:${@port}')
}
fn pub fmt(formatter: mut Formatter)
Formats self
in a human-readable format for debugging purposes.
ip
Show source codeHide source code
fn pub ip -> Option[IpAddress] {
IpAddress.parse(@address)
}
fn pub ip -> Option[IpAddress]
Returns the IPv4/IPv6 address associated with self
.
Implemented traits
Equal
impl Equal[ref SocketAddress] for SocketAddress
Format
impl Format for SocketAddress