Skip to content

Commit 1a73b72

Browse files
committed
Tweak comments, reorder target_os in #[cfg] conditions.
1 parent ef40c9c commit 1a73b72

File tree

3 files changed

+31
-16
lines changed

3 files changed

+31
-16
lines changed

src/ifaddrs.rs

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -108,9 +108,10 @@ impl Iterator for InterfaceAddressIterator {
108108

109109
/// Get interface addresses using libc's `getifaddrs`
110110
///
111-
/// Note that the underlying implementation differs between OSes and the nix
112-
/// crate doesn't support `AF_PACKET` entries. Therefore, the returned list
113-
/// often contains empty entries.
111+
/// Note that the underlying implementation differs between OSes. Only the
112+
/// most common address families are supported by the nix crate (due to
113+
/// lack of time and complexity of testing). For any entry not supported,
114+
/// the returned list will contain a `None` entry.
114115
///
115116
/// # Example
116117
/// ```

src/lib.rs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,13 @@ pub mod poll;
4343

4444
pub mod net;
4545

46-
#[cfg(any(target_os = "dragonfly", target_os = "freebsd", target_os = "netbsd",
47-
target_os = "ios", target_os = "macos", target_os = "openbsd", target_os = "linux", ))]
46+
#[cfg(any(target_os = "dragonfly",
47+
target_os = "freebsd",
48+
target_os = "ios",
49+
target_os = "linux",
50+
target_os = "macos",
51+
target_os = "netbsd",
52+
target_os = "openbsd"))]
4853
pub mod ifaddrs;
4954

5055
#[cfg(any(target_os = "linux", target_os = "android"))]

src/net/if_.rs

Lines changed: 20 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,26 @@ libc_bitflags!(
3636
/// Interface is a point-to-point link. (see
3737
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
3838
IFF_POINTOPOINT;
39-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "ios",
40-
target_os = "linux", target_os = "macos", target_os = "netbsd",
41-
target_os = "openbsd"))]
4239
/// Avoid use of trailers. (see
4340
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
41+
#[cfg(any(target_os = "android",
42+
target_os = "fuchsia",
43+
target_os = "ios",
44+
target_os = "linux",
45+
target_os = "macos",
46+
target_os = "netbsd",
47+
target_os = "openbsd"))]
4448
IFF_NOTRAILERS;
45-
#[cfg(any(target_os = "android", target_os = "dragonfly", target_os = "fuchsia",
46-
target_os = "ios", target_os = "linux", target_os = "macos",
47-
target_os = "netbsd", target_os = "openbsd"))]
4849
/// Resources allocated. (see
4950
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
51+
#[cfg(any(target_os = "android",
52+
target_os = "dragonfly",
53+
target_os = "fuchsia",
54+
target_os = "ios",
55+
target_os = "linux",
56+
target_os = "macos",
57+
target_os = "netbsd",
58+
target_os = "openbsd"))]
5059
IFF_RUNNING;
5160
/// No arp protocol, L2 destination address not set. (see
5261
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
@@ -57,28 +66,28 @@ libc_bitflags!(
5766
/// Receive all multicast packets. (see
5867
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
5968
IFF_ALLMULTI;
60-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
6169
/// Master of a load balancing bundle. (see
6270
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
63-
IFF_MASTER;
6471
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
72+
IFF_MASTER;
6573
/// Slave of a load balancing bundle. (see
6674
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
75+
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
6776
IFF_SLAVE;
6877
/// Supports multicast. (see
6978
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
7079
IFF_MULTICAST;
71-
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
7280
/// Is able to select media type via ifmap. (see
7381
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
74-
IFF_PORTSEL;
7582
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
83+
IFF_PORTSEL;
7684
/// Auto media selection active. (see
7785
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
78-
IFF_AUTOMEDIA;
7986
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
87+
IFF_AUTOMEDIA;
8088
/// The addresses are lost when the interface goes down. (see
8189
/// [`netdevice(7)`](http://man7.org/linux/man-pages/man7/netdevice.7.html))
90+
#[cfg(any(target_os = "android", target_os = "fuchsia", target_os = "linux"))]
8291
IFF_DYNAMIC;
8392
}
8493
);

0 commit comments

Comments
 (0)