diff options
author | Alan Somers <asomers@gmail.com> | 2021-08-13 18:08:02 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-08-13 18:08:02 -0600 |
commit | 5ed5bb634fbef82c5dcd6e64e9b609dff08e378d (patch) | |
tree | 0cb3768e6972f2379c6e68f750fb9f615b13722b /src/sys/socket | |
parent | 06b5d3344a433c30059e165675107cf232f3e145 (diff) | |
parent | 8acdaef51a1fec5dabfffcf718a5ec58b0b11045 (diff) | |
download | nix-5ed5bb634fbef82c5dcd6e64e9b609dff08e378d.zip |
Merge pull request #1492 from asomers/bitflags_1.3.1
Fix the build with bitflags-1.3.0 and newer
Diffstat (limited to 'src/sys/socket')
-rw-r--r-- | src/sys/socket/addr.rs | 8 |
1 files changed, 4 insertions, 4 deletions
diff --git a/src/sys/socket/addr.rs b/src/sys/socket/addr.rs index 366c9afd..a964d61b 100644 --- a/src/sys/socket/addr.rs +++ b/src/sys/socket/addr.rs @@ -237,7 +237,7 @@ impl AddressFamily { /// /// Currently only supports these address families: Unix, Inet (v4 & v6), Netlink, Link/Packet /// and System. Returns None for unsupported or unknown address families. - pub fn from_i32(family: i32) -> Option<AddressFamily> { + pub const fn from_i32(family: i32) -> Option<AddressFamily> { match family { libc::AF_UNIX => Some(AddressFamily::Unix), libc::AF_INET => Some(AddressFamily::Inet), @@ -314,7 +314,7 @@ impl InetAddr { } } /// Gets the IP address associated with this socket address. - pub fn ip(&self) -> IpAddr { + pub const fn ip(&self) -> IpAddr { match *self { InetAddr::V4(ref sa) => IpAddr::V4(Ipv4Addr(sa.sin_addr)), InetAddr::V6(ref sa) => IpAddr::V6(Ipv6Addr(sa.sin6_addr)), @@ -322,7 +322,7 @@ impl InetAddr { } /// Gets the port number associated with this socket address - pub fn port(&self) -> u16 { + pub const fn port(&self) -> u16 { match *self { InetAddr::V6(ref sa) => u16::from_be(sa.sin6_port), InetAddr::V4(ref sa) => u16::from_be(sa.sin_port), @@ -393,7 +393,7 @@ impl IpAddr { } } - pub fn to_std(&self) -> net::IpAddr { + pub const fn to_std(&self) -> net::IpAddr { match *self { IpAddr::V4(ref ip) => net::IpAddr::V4(ip.to_std()), IpAddr::V6(ref ip) => net::IpAddr::V6(ip.to_std()), |