pub enum IpAddr {
V4(Ipv4Addr),
V6(Ipv6Addr),
}
Expand description
Represents a host address that can be either an IPv4 address or an IPv6 address chosen dynamically at runtime.
Variants§
Implementations§
Source§impl IpAddr
impl IpAddr
Sourcepub const fn to_ipv6_mapped(self) -> Ipv6Addr
pub const fn to_ipv6_mapped(self) -> Ipv6Addr
Returns the equivalent IPv6 address, either directly (when the source is already IPv6) or as an IPv4-mapped-in-IPv6 address.
The Linux IPv6 implementation can support IPv4 too when using a
mapped address, so using this method can allow the rest of the program
to use AF_INET6
exclusively, if desired.
Trait Implementations§
impl Copy 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 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