pub enum IPAddress {
V4(IPv4Address),
V6(IPv6Address),
}Expand description
Either an IPv4Address or an IPv6Address.
Variants§
Implementations§
Source§impl IPAddress
Conversions
impl IPAddress
Conversions
Sourcepub const fn to_v4(self) -> Result<IPv4Address, Self>
pub const fn to_v4(self) -> Result<IPv4Address, Self>
Converts the address to an IPv4 address.
Sourcepub const fn to_v6(self) -> Result<IPv6Address, Self>
pub const fn to_v6(self) -> Result<IPv6Address, Self>
Converts the address to an IPv6 address.
Sourcepub const fn to_socket(self, port: u16) -> SocketAddress
pub const fn to_socket(self, port: u16) -> SocketAddress
Converts the address to a socket address with the port.
Sourcepub const fn to_host_ref(self) -> HostRef<'static>
pub const fn to_host_ref(self) -> HostRef<'static>
Converts the address to a host reference.
Trait Implementations§
impl Copy for IPAddress
Source§impl<'de> Deserialize<'de> for IPAddress
Available on crate feature serde only.
impl<'de> Deserialize<'de> for IPAddress
Available on crate feature
serde only.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 IPAddress
Source§impl From<IPv4Address> for IPAddress
impl From<IPv4Address> for IPAddress
Source§fn from(v4: IPv4Address) -> Self
fn from(v4: IPv4Address) -> Self
Converts to this type from the input type.
Source§impl From<IPv6Address> for IPAddress
impl From<IPv6Address> for IPAddress
Source§fn from(v6: IPv6Address) -> Self
fn from(v6: IPv6Address) -> Self
Converts to this type from the input type.
Source§impl Ord for IPAddress
impl Ord for IPAddress
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialOrd for IPAddress
impl PartialOrd for IPAddress
impl StructuralPartialEq for IPAddress
Source§impl TryFrom<IPAddress> for IPv4Address
impl TryFrom<IPAddress> for IPv4Address
Auto Trait Implementations§
impl Freeze for IPAddress
impl RefUnwindSafe for IPAddress
impl Send for IPAddress
impl Sync for IPAddress
impl Unpin for IPAddress
impl UnsafeUnpin for IPAddress
impl UnwindSafe for IPAddress
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