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 = _
pub const UNSPECIFIED: Address = _
An unspecified address.
Sourcepub const MULTICAST_ALL_SYSTEMS: Address = _
pub const MULTICAST_ALL_SYSTEMS: Address = _
All multicast-capable nodes
Sourcepub const MULTICAST_ALL_ROUTERS: Address = _
pub const MULTICAST_ALL_ROUTERS: Address = _
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) -> IpAddress
pub const fn into_address(self) -> IpAddress
Convert to an IpAddress
.
Same as .into()
, but works in const
.
Trait Implementations§
Source§impl From<Address> for Address
impl From<Address> for Address
Source§fn from(addr: Ipv4Address) -> Self
fn from(addr: Ipv4Address) -> Self
Converts to this type from the input type.
Source§impl FromStr for Ipv4Address
impl FromStr for Ipv4Address
Source§impl Ord for Address
impl Ord for Address
Source§impl PartialOrd for Address
impl PartialOrd for Address
impl Copy for Address
impl Eq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
impl Freeze for Address
impl RefUnwindSafe for Address
impl Send for Address
impl Sync for Address
impl Unpin for Address
impl UnwindSafe for Address
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more