Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Converts AddressFamily to struct with associated consts #2210

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/2210.added.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Added more `AddressFamily` variants.
1 change: 1 addition & 0 deletions changelog/2210.changed.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Converted `AddressFamily` to struct with associated constants to support vendor-defined address families.
2 changes: 1 addition & 1 deletion examples/getifaddrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ fn main() {
let family = addr
.address
.as_ref()
.and_then(SockaddrStorage::family)
.map(SockaddrStorage::family)
.map(|af| format!("{:?}", af))
.unwrap_or("".to_owned());
match (
Expand Down
5 changes: 2 additions & 3 deletions src/ifaddrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -200,11 +200,10 @@ mod tests {
} else {
continue;
};
if sock.family() == Some(crate::sys::socket::AddressFamily::Inet) {
if sock.family() == crate::sys::socket::AddressFamily::INET {
let _ = sock.as_sockaddr_in().unwrap();
return;
} else if sock.family()
== Some(crate::sys::socket::AddressFamily::Inet6)
} else if sock.family() == crate::sys::socket::AddressFamily::INET6
{
let _ = sock.as_sockaddr_in6().unwrap();
return;
Expand Down
Loading