pub struct Ipv6Address(pub [u8; 16]);
Expand description
A sixteen-octet IPv6 address.
Tuple Fields§
§0: [u8; 16]
Implementations§
Source§impl Address
impl Address
Sourcepub const UNSPECIFIED: Address = _
pub const UNSPECIFIED: Address = _
The unspecified address.
Sourcepub const LINK_LOCAL_ALL_NODES: Address = _
pub const LINK_LOCAL_ALL_NODES: Address = _
The link-local all nodes multicast address.
Sourcepub const LINK_LOCAL_ALL_ROUTERS: Address = _
pub const LINK_LOCAL_ALL_ROUTERS: Address = _
The link-local all routers multicast address.
Sourcepub const LINK_LOCAL_ALL_RPL_NODES: Address = _
pub const LINK_LOCAL_ALL_RPL_NODES: Address = _
The link-local all RPL nodes multicast address.
Sourcepub const LOOPBACK: Address = _
pub const LOOPBACK: Address = _
The loopback address.
Sourcepub const IPV4_MAPPED_PREFIX: [u8; 12] = _
pub const IPV4_MAPPED_PREFIX: [u8; 12] = _
The prefix used in IPv4-mapped addresses.
Sourcepub const fn new(
a0: u16,
a1: u16,
a2: u16,
a3: u16,
a4: u16,
a5: u16,
a6: u16,
a7: u16,
) -> Address
pub const fn new( a0: u16, a1: u16, a2: u16, a3: u16, a4: u16, a5: u16, a6: u16, a7: u16, ) -> Address
Construct an IPv6 address from parts.
Sourcepub fn from_bytes(data: &[u8]) -> Address
pub fn from_bytes(data: &[u8]) -> Address
Construct an IPv6 address from a sequence of octets, in big-endian.
§Panics
The function panics if data
is not sixteen octets long.
Sourcepub fn from_parts(data: &[u16]) -> Address
pub fn from_parts(data: &[u16]) -> Address
Construct an IPv6 address from a sequence of words, in big-endian.
§Panics
The function panics if data
is not 8 words long.
Sourcepub fn write_parts(&self, data: &mut [u16])
pub fn write_parts(&self, data: &mut [u16])
Sourcepub const fn as_bytes(&self) -> &[u8]
pub const fn as_bytes(&self) -> &[u8]
Return an IPv6 address as a sequence of octets, in big-endian.
Sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Query whether the IPv6 address is an unicast address.
Sourcepub const fn is_global_unicast(&self) -> bool
pub const fn is_global_unicast(&self) -> bool
Query whether the IPv6 address is a global unicast address.
Sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Query whether the IPv6 address is a multicast address.
Sourcepub fn is_unspecified(&self) -> bool
pub fn is_unspecified(&self) -> bool
Query whether the IPv6 address is the unspecified address.
Sourcepub fn is_link_local(&self) -> bool
pub fn is_link_local(&self) -> bool
Query whether the IPv6 address is in the link-local scope.
Sourcepub fn is_unique_local(&self) -> bool
pub fn is_unique_local(&self) -> bool
Query whether the IPv6 address is a Unique Local Address (ULA).
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Query whether the IPv6 address is the loopback address.
Sourcepub fn is_ipv4_mapped(&self) -> bool
pub fn is_ipv4_mapped(&self) -> bool
Query whether the IPv6 address is an IPv4 mapped IPv6 address.
Sourcepub fn as_ipv4(&self) -> Option<Address>
pub fn as_ipv4(&self) -> Option<Address>
Convert an IPv4 mapped IPv6 address to an IPv4 address.
Sourcepub fn solicited_node(&self) -> Address
pub fn solicited_node(&self) -> Address
The solicited node for the given unicast address.
§Panics
This function panics if the given address is not unicast.
Sourcepub const fn into_address(self) -> IpAddress
pub const fn into_address(self) -> IpAddress
Convert to an IpAddress
.
Same as .into()
, but works in const
.