doc.rust-lang.org
pub const fn ip(&self) -> IpAddr
Returns the IP address associated with this socket address.
method
core
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub enum SocketAddr
An internet socket address, either IPv4 or IPv6.
enum
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub struct AddrParseError
An error which can be returned when parsing an IP address or a socket address.
struct
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn to_ipv4_mapped(&self) -> Option<Ipv4Addr>
Converts this address to an IPv4 address if it's an IPv4-mapped address, as defined in IETF RFC 4291 section 2.5.5.2, otherwise returns None.
method
core
Stable since 1.63.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn to_ipv4(&self) -> Option<Ipv4Addr>
Converts this address to an IPv4 address if it is either an IPv4-compatible address as defined in IETF RFC 4291 section 2.5.5.1, or an IPv4-mapped address as defined in IETF RFC 4291 section 2.5.5.2, otherwise returns None.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn to_canonical(&self) -> IpAddr
Converts this address to an IpAddr::V4 if it is an IPv4-mapped address, otherwise returns self wrapped in an IpAddr::V6.
method
core
Stable since 1.75.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn to_bits(self) -> u128
Converts an IPv6 address into a u128 representation using native byte order.
method
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn segments(&self) -> [u16; 8]
Returns the eight 16-bit segments that make up this address.
method
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn octets(&self) -> [u8; 16]
Returns the sixteen eight-bit integers the IPv6 address consists of.
method
core
Stable since 1.12.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn new(a: u16, b: u16, c: u16, d: u16, e: u16, f: u16, g: u16, h: u16) -> Ipv6Addr
Creates a new IPv6 address from eight 16-bit segments.
associated_function
core
Stable since 1.0.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_unspecified(&self) -> bool
Returns true for the special 'unspecified' address (::).
method
core
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_unique_local(&self) -> bool
Returns true if this is a unique local address (fc00::/7).
method
core
Stable since 1.84.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_unicast_link_local(&self) -> bool
Returns true if the address is a unicast address with link-local scope, as defined in RFC 4291.
method
core
Stable since 1.84.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_multicast(&self) -> bool
Returns true if this is a multicast address (ff00::/8).
method
core
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn is_loopback(&self) -> bool
Returns true if this is the loopback address (::1), as defined in IETF RFC 4291 section 2.5.3.
method
core
Stable since 1.7.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_segments(segments: [u16; 8]) -> Ipv6Addr
Creates an Ipv6Addr from an eight element 16-bit array.
associated_function
core
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_octets(octets: [u8; 16]) -> Ipv6Addr
Creates an Ipv6Addr from a sixteen element byte array.
associated_function
core
Stable since 1.91.0
Version 1.100.0-nightly
doc.rust-lang.org
pub const fn from_bits(bits: u128) -> Ipv6Addr
Converts a native byte order u128 into an IPv6 address.
associated_function
core
Stable since 1.80.0
Version 1.100.0-nightly
doc.rust-lang.org
const UNSPECIFIED: Self
An IPv6 address representing the unspecified address: ::.
associated_constant
core
Stable since 1.30.0
Version 1.100.0-nightly
doc.rust-lang.org
const LOCALHOST: Self
An IPv6 address representing localhost: ::1.
associated_constant
core
Stable since 1.30.0
Version 1.100.0-nightly