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.
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.
Additional functions available when the std
feature is active, for
integrating with the standard library.
Available on crate feature std
only.
Converts the standard library’s representation of IPv4 addresses into
our representation.
Performs copy-assignment from
source
.
Read more
Formats the value using the given formatter.
Read moresource§Available on crate feature std
only.
Converts to this type from the input type.
Converts to this type from the input type.
Converts to this type from the input type.
Immutably borrows from an owned value.
Read more
Mutably borrows from an owned value.
Read more
Returns the argument unchanged.
Calls U::from(self)
.
That is, this conversion is whatever the implementation of
From<T> for U
chooses to do.
The resulting type after obtaining ownership.
Creates owned data from borrowed data, usually by cloning.
Read more
Uses borrowed data to replace owned data, usually by cloning.
Read more
The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.