pub enum IpAddr {
Ipv4(Address),
}
Expand description
An internetworking address.
Variants§
Implementations§
§impl Address
impl Address
pub 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.
pub const fn version(&self) -> Version
pub const fn version(&self) -> Version
Return the protocol version.
pub fn is_unicast(&self) -> bool
pub fn is_unicast(&self) -> bool
Query whether the address is a valid unicast address.
pub const fn is_multicast(&self) -> bool
pub const fn is_multicast(&self) -> bool
Query whether the address is a valid multicast address.
pub fn is_broadcast(&self) -> bool
pub fn is_broadcast(&self) -> bool
Query whether the address is the broadcast address.
pub fn is_unspecified(&self) -> bool
pub fn is_unspecified(&self) -> bool
Query whether the address falls into the “unspecified” range.
pub 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§
§impl Ord for Address
impl Ord for Address
§impl PartialOrd for Address
impl PartialOrd for Address
§fn partial_cmp(&self, other: &Address) -> Option<Ordering>
fn partial_cmp(&self, other: &Address) -> Option<Ordering>
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 moreimpl Copy for Address
impl Eq for Address
impl StructuralEq for Address
impl StructuralPartialEq for Address
Auto Trait Implementations§
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