#[non_exhaustive]pub enum IpAddr {
V4([u8; 4]),
V6([u8; 16]),
}Expand description
IP address representation (supports IPv4 and IPv6).
Tier: T2-P (λ Location — network address)
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
Non-exhaustive enums could have additional variants added in future. Therefore, when matching against variants of non-exhaustive enums, an extra wildcard arm must be added to account for any future variants.
Implementations§
Source§impl IpAddr
impl IpAddr
Sourcepub const fn loopback_v4() -> Self
pub const fn loopback_v4() -> Self
Create the loopback address (127.0.0.1).
Sourcepub const fn unspecified_v4() -> Self
pub const fn unspecified_v4() -> Self
Create the unspecified address (0.0.0.0).
Sourcepub fn is_loopback(&self) -> bool
pub fn is_loopback(&self) -> bool
Whether this is a loopback address.
Sourcepub fn is_private(&self) -> bool
pub fn is_private(&self) -> bool
Whether this is a private/local address.
Sourcepub fn to_string_repr(&self) -> String
pub fn to_string_repr(&self) -> String
Format as string.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for IpAddr
impl<'de> Deserialize<'de> for IpAddr
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Eq for IpAddr
impl StructuralPartialEq for IpAddr
Auto Trait Implementations§
impl Freeze for IpAddr
impl RefUnwindSafe for IpAddr
impl Send for IpAddr
impl Sync for IpAddr
impl Unpin for IpAddr
impl UnsafeUnpin for IpAddr
impl UnwindSafe for IpAddr
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