Skip to content

Commit 3ae5caf

Browse files
committed
Converts AddressFamily to struct with associated consts
1 parent 39ad47b commit 3ae5caf

File tree

10 files changed

+547
-374
lines changed

10 files changed

+547
-374
lines changed

build.rs

+3
Original file line numberDiff line numberDiff line change
@@ -6,11 +6,14 @@ fn main() {
66
dragonfly: { target_os = "dragonfly" },
77
ios: { target_os = "ios" },
88
freebsd: { target_os = "freebsd" },
9+
fuchsia: { target_os = "fuchsia" },
10+
haiku: { target_os = "haiku" },
911
illumos: { target_os = "illumos" },
1012
linux: { target_os = "linux" },
1113
macos: { target_os = "macos" },
1214
netbsd: { target_os = "netbsd" },
1315
openbsd: { target_os = "openbsd" },
16+
redox: { target_os = "redox" },
1417
solaris: { target_os = "solaris" },
1518
watchos: { target_os = "watchos" },
1619
tvos: { target_os = "tvos" },

changelog/2210.added.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Added more `AddressFamily` variants.

changelog/2210.changed.md

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Converted `AddressFamily` to struct with associated constants to support vendor-defined address families.

examples/getifaddrs.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ fn main() {
2929
let family = addr
3030
.address
3131
.as_ref()
32-
.and_then(SockaddrStorage::family)
32+
.map(SockaddrStorage::family)
3333
.map(|af| format!("{:?}", af))
3434
.unwrap_or("".to_owned());
3535
match (

src/ifaddrs.rs

+2-3
Original file line numberDiff line numberDiff line change
@@ -200,11 +200,10 @@ mod tests {
200200
} else {
201201
continue;
202202
};
203-
if sock.family() == Some(crate::sys::socket::AddressFamily::Inet) {
203+
if sock.family() == crate::sys::socket::AddressFamily::INET {
204204
let _ = sock.as_sockaddr_in().unwrap();
205205
return;
206-
} else if sock.family()
207-
== Some(crate::sys::socket::AddressFamily::Inet6)
206+
} else if sock.family() == crate::sys::socket::AddressFamily::INET6
208207
{
209208
let _ = sock.as_sockaddr_in6().unwrap();
210209
return;

0 commit comments

Comments
 (0)