Enum embassy_net::IpAddress
source · pub enum IpAddress {
Ipv4(Address),
Ipv6(Address),
}
Expand description
An internetworking address.
Variants§
Implementations§
source§impl Address
impl Address
sourcepub const fn v4(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
pub const fn v4(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
Create an address wrapping an IPv4 address with the given octets.
sourcepub fn v6(
a0: u16,
a1: u16,
a2: u16,
a3: u16,
a4: u16,
a5: u16,
a6: u16,
a7: u16
) -> Address
pub fn v6(
a0: u16,
a1: u16,
a2: u16,
a3: u16,
a4: u16,
a5: u16,
a6: u16,
a7: u16
) -> Address
Create an address wrapping an IPv6 address with the given octets.
sourcepub const fn as_bytes(&self) -> &[u8]
pub const fn as_bytes(&self) -> &[u8]
Return an address as a sequence of octets, in big-endian.
sourcepub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Query whether the address is a valid unicast address.
sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Query whether the address is a valid multicast address.
sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Query whether the address is the broadcast address.
sourcepub fn is_unspecified(&self) -> bool
pub fn is_unspecified(&self) -> bool
Query whether the address falls into the “unspecified” range.
sourcepub fn prefix_len(&self) -> Option<u8>
pub fn prefix_len(&self) -> Option<u8>
If self
is a CIDR-compatible subnet mask, return Some(prefix_len)
,
where prefix_len
is the number of leading zeroes. Return None
otherwise.
Trait Implementations§
source§impl Ord for Address
impl Ord for Address
source§impl PartialEq<Address> for Address
impl PartialEq<Address> for Address
source§impl PartialOrd<Address> for Address
impl PartialOrd<Address> for Address
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read more