struct SocketAddr
pub struct SocketAddr :: [Equatable, Debug]
Conforms to Equatable, Debug, Display, Parse.
An IP address and a port.
Fields
pub ip: IpAddr
pub port: uint16
Methods
fn show(): string
Returns 192.0.2.1:8080; a version 6 address in brackets, [::1]:8080 (RFC 3986).
static fn parse(s: StringView): SocketAddr throws ParseError
Parses 192.0.2.1:8080 or [2001:db8::1]:8080: the address as IpAddr.parse takes it —
a version 6 address in brackets, a version 4 one without —, then a decimal port up to
65535.
Errors
Throws ParseError: Empty for empty text, Invalid for a missing or bad port, an
unclosed bracket, or an address that is not of the right form.