Struct embassy_net::Ipv4Address
source · pub struct Ipv4Address(pub [u8; 4]);
Expand description
A four-octet IPv4 address.
Tuple Fields§
§0: [u8; 4]
Implementations§
source§impl Address
impl Address
sourcepub const UNSPECIFIED: Address = Address([0; ADDR_SIZE])
pub const UNSPECIFIED: Address = Address([0; ADDR_SIZE])
An unspecified address.
sourcepub const MULTICAST_ALL_SYSTEMS: Address = Address([224, 0, 0, 1])
pub const MULTICAST_ALL_SYSTEMS: Address = Address([224, 0, 0, 1])
All multicast-capable nodes
sourcepub const MULTICAST_ALL_ROUTERS: Address = Address([224, 0, 0, 2])
pub const MULTICAST_ALL_ROUTERS: Address = Address([224, 0, 0, 2])
All multicast-capable routers
sourcepub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
pub const fn new(a0: u8, a1: u8, a2: u8, a3: u8) -> Address
Construct an IPv4 address from parts.
sourcepub fn from_bytes(data: &[u8]) -> Address
pub fn from_bytes(data: &[u8]) -> Address
Construct an IPv4 address from a sequence of octets, in big-endian.
Panics
The function panics if data
is not four octets long.
sourcepub const fn as_bytes(&self) -> &[u8]
pub const fn as_bytes(&self) -> &[u8]
Return an IPv4 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 an unicast address.
sourcepub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Query whether the address is the broadcast address.
sourcepub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Query whether the address is a multicast address.
sourcepub const fn is_unspecified(&self) -> bool
pub const fn is_unspecified(&self) -> bool
Query whether the address falls into the “unspecified” range.
sourcepub fn is_link_local(&self) -> bool
pub fn is_link_local(&self) -> bool
Query whether the address falls into the “link-local” range.
sourcepub const fn is_loopback(&self) -> bool
pub const fn is_loopback(&self) -> bool
Query whether the address falls into the “loopback” range.
sourcepub const fn into_address(self) -> Address
pub const fn into_address(self) -> Address
Convert to an IpAddress
.
Same as .into()
, but works in const
.
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