Skip to content

Commit

Permalink
Merge #813
Browse files Browse the repository at this point in the history
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
  • Loading branch information
bors[bot] committed Jan 11, 2018
2 parents abd72be + cf7c2dc commit a00bd10
Show file tree
Hide file tree
Showing 4 changed files with 468 additions and 14 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ This project adheres to [Semantic Versioning](http://semver.org/).
([#814](https://github.com/nix-rust/nix/pull/814))
- Added `sigprocmask` to the signal module.
([#826](https://github.com/nix-rust/nix/pull/826))
- Added `nix::sys::socket::LinkAddr` on Linux and all bsdlike system.
([#813](https://github.com/nix-rust/nix/pull/813))

### Changed
- Use native `pipe2` on all BSD targets. Users should notice no difference.
Expand Down
9 changes: 1 addition & 8 deletions src/ifaddrs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
//! of interfaces and their associated addresses.

use std::ffi;
use std::fmt;
use std::iter::Iterator;
use std::mem;
use std::option::Option;
Expand All @@ -16,7 +15,7 @@ use sys::socket::SockAddr;
use net::if_::*;

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

impl fmt::Debug for InterfaceAddress {
fn fmt(&self, f: &mut fmt::Formatter) -> fmt::Result {
write!(f, "InterfaceAddress ({:?})", self.interface_name)
}
}

cfg_if! {
if #[cfg(any(target_os = "emscripten", target_os = "fuchsia", target_os = "linux"))] {
fn get_ifu_from_sockaddr(info: &libc::ifaddrs) -> *const libc::sockaddr {
Expand Down
Loading

0 comments on commit a00bd10

Please sign in to comment.