Skip to content

Commit

Permalink
Link methods in From impls
Browse files Browse the repository at this point in the history
  • Loading branch information
clarfonthey committed Jul 19, 2023
1 parent 60e997f commit a00a0f3
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions core/src/net/ip_addr.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1120,6 +1120,7 @@ impl Ord for Ipv4Addr {

#[stable(feature = "ip_u32", since = "1.1.0")]
impl From<Ipv4Addr> for u32 {
/// Uses [`Ipv4Addr::to_bits`] to convert an IPv4 address to a host byte order `u32`.
#[inline]
fn from(ip: Ipv4Addr) -> u32 {
ip.to_bits()
Expand All @@ -1128,6 +1129,7 @@ impl From<Ipv4Addr> for u32 {

#[stable(feature = "ip_u32", since = "1.1.0")]
impl From<u32> for Ipv4Addr {
/// Uses [`Ipv4Addr::from_bits`] to convert a host byte order `u32` into an IPv4 address.
#[inline]
fn from(ip: u32) -> Ipv4Addr {
Ipv4Addr::from_bits(ip)
Expand Down Expand Up @@ -1995,13 +1997,15 @@ impl Ord for Ipv6Addr {

#[stable(feature = "i128", since = "1.26.0")]
impl From<Ipv6Addr> for u128 {
/// Uses [`Ipv6Addr::to_bits`] to convert an IPv6 address to a host byte order `u128`.
#[inline]
fn from(ip: Ipv6Addr) -> u128 {
ip.to_bits()
}
}
#[stable(feature = "i128", since = "1.26.0")]
impl From<u128> for Ipv6Addr {
/// Uses [`Ipv6Addr::from_bits`] to convert a host byte order `u128` to an IPv6 address.
#[inline]
fn from(ip: u128) -> Ipv6Addr {
Ipv6Addr::from_bits(ip)
Expand Down

0 comments on commit a00a0f3

Please sign in to comment.