Skip to content

Commit a00bd10

Browse files
committed
Merge #813
813: Support `EtherAddr` and impl `Debug` for `InterfaceAddress/SockAddr` r=Susurrus a=LuoZijun 1. Add `EtherAddr` . 2. impl `Debug` for `InterfaceAddress` and `SockAddr`. Closes #809
2 parents abd72be + cf7c2dc commit a00bd10

File tree

4 files changed

+468
-14
lines changed

4 files changed

+468
-14
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
5252
([#814](https://github.com/nix-rust/nix/pull/814))
5353
- Added `sigprocmask` to the signal module.
5454
([#826](https://github.com/nix-rust/nix/pull/826))
55+
- Added `nix::sys::socket::LinkAddr` on Linux and all bsdlike system.
56+
([#813](https://github.com/nix-rust/nix/pull/813))
5557

5658
### Changed
5759
- Use native `pipe2` on all BSD targets. Users should notice no difference.

src/ifaddrs.rs

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44
//! of interfaces and their associated addresses.
55
66
use std::ffi;
7-
use std::fmt;
87
use std::iter::Iterator;
98
use std::mem;
109
use std::option::Option;
@@ -16,7 +15,7 @@ use sys::socket::SockAddr;
1615
use net::if_::*;
1716

1817
/// Describes a single address for an interface as returned by `getifaddrs`.
19-
#[derive(Clone, Eq, Hash, PartialEq)]
18+
#[derive(Clone, Eq, Hash, PartialEq, Debug)]
2019
pub struct InterfaceAddress {
2120
/// Name of the network interface
2221
pub interface_name: String,
@@ -32,12 +31,6 @@ pub struct InterfaceAddress {
3231
pub destination: Option<SockAddr>,
3332
}
3433

35-
impl fmt::Debug for InterfaceAddress {
36-
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
37-
write!(f, "InterfaceAddress ({:?})", self.interface_name)
38-
}
39-
}
40-
4134
cfg_if! {
4235
if #[cfg(any(target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] {
4336
fn get_ifu_from_sockaddr(info: &libc::ifaddrs) -> *const libc::sockaddr {

0 commit comments

Comments
 (0)