@@ -3,80 +3,85 @@ use std::convert::TryFrom;
33#[ cfg( feature = "serde" ) ]
44use serde:: { Deserialize , Serialize } ;
55
6- /// Type of Network Interface
6+ /// Cross-platform classification of a network interface.
7+ ///
8+ /// The variants normalize platform-specific type identifiers.
79#[ derive( Clone , Copy , Eq , PartialEq , Hash , Debug ) ]
810#[ cfg_attr( feature = "serde" , derive( Serialize , Deserialize ) ) ]
911pub enum InterfaceType {
10- /// Unknown interface type
12+ /// Interface type could not be determined.
1113 Unknown ,
12- /// The network interface using an Ethernet connection
14+ /// Ethernet interface.
1315 Ethernet ,
14- /// The network interface using a Token- Ring connection
16+ /// Token Ring interface.
1517 TokenRing ,
16- /// The network interface using a Fiber Distributed Data Interface (FDDI) connection
18+ /// Fiber Distributed Data Interface (FDDI).
1719 Fddi ,
18- /// The network interface using a basic rate interface Integrated Services Digital Network ( ISDN) connection
20+ /// Basic- rate ISDN interface.
1921 BasicIsdn ,
20- /// The network interface using a primary rate interface Integrated Services Digital Network ( ISDN) connection
22+ /// Primary- rate ISDN interface.
2123 PrimaryIsdn ,
22- /// The network interface using a Point-To -Point protocol (PPP) connection
24+ /// Point-to -Point Protocol (PPP) interface.
2325 Ppp ,
24- /// The loopback interface (often used for testing)
26+ /// Loopback interface.
2527 Loopback ,
26- /// The network interface using an Ethernet 3 megabit/second connection
28+ /// Legacy 3 Mbps Ethernet interface.
2729 Ethernet3Megabit ,
28- /// The network interface using a Serial Line Internet Protocol (SLIP) connection
30+ /// Serial Line Internet Protocol (SLIP) interface.
2931 Slip ,
30- /// The network interface using asynchronous transfer mode (ATM) for data transmission
32+ /// Asynchronous Transfer Mode (ATM) interface.
3133 Atm ,
32- /// The network interface using a modem
34+ /// Generic modem interface.
3335 GenericModem ,
34- /// Proprietary virtual/ internal interface
36+ /// Proprietary virtual or internal interface.
3537 ProprietaryVirtual ,
36- /// The network interface using a Fast Ethernet connection over twisted pair and provides a data rate of 100 megabits per second (100BASE-T)
38+ /// Fast Ethernet over twisted pair.
3739 FastEthernetT ,
38- /// The network interface using a connection configured for ISDN and the X.25 protocol .
40+ /// ISDN/ X.25 interface .
3941 Isdn ,
40- /// The network interface using a Fast Ethernet connection over optical fiber and provides a data rate of 100 megabits per second (100Base-FX)
42+ /// Fast Ethernet over fiber.
4143 FastEthernetFx ,
42- /// The network interface using a wireless LAN connection (IEEE 802.11)
44+ /// IEEE 802.11 wireless LAN interface.
4345 Wireless80211 ,
44- /// The network interface using an Asymmetric Digital Subscriber Line (ADSL)
46+ /// Asymmetric DSL interface.
4547 AsymmetricDsl ,
46- /// The network interface using a Rate Adaptive Digital Subscriber Line (RADSL)
48+ /// Rate-adaptive DSL interface.
4749 RateAdaptDsl ,
48- /// The network interface using a Symmetric Digital Subscriber Line (SDSL)
50+ /// Symmetric DSL interface.
4951 SymmetricDsl ,
50- /// The network interface using a Very High Data Rate Digital Subscriber Line (VDSL)
52+ /// Very-high-bit-rate DSL interface.
5153 VeryHighSpeedDsl ,
52- /// The network interface using the Internet Protocol (IP) in combination with asynchronous transfer mode ( ATM) for data transmission
54+ /// IP over ATM interface.
5355 IPOverAtm ,
54- /// The network interface using a gigabit Ethernet connection and provides a data rate of 1,000 megabits per second (1 gigabit per second)
56+ /// Gigabit Ethernet interface.
5557 GigabitEthernet ,
56- /// The network interface using a tunnel connection
58+ /// Tunnel interface.
5759 Tunnel ,
58- /// The network interface using a Multirate Digital Subscriber Line
60+ /// Multirate symmetric DSL interface.
5961 MultiRateSymmetricDsl ,
60- /// The network interface using a High Performance Serial Bus
62+ /// High-performance serial bus interface.
6163 HighPerformanceSerialBus ,
62- /// The network interface using a mobile broadband interface for WiMax devices
64+ /// Mobile broadband interface for WiMAX devices.
6365 Wman ,
64- /// The network interface using a mobile broadband interface for GSM-based devices
66+ /// Mobile broadband interface for GSM-based devices.
6567 Wwanpp ,
66- /// The network interface using a mobile broadband interface for CDMA-based devices
68+ /// Mobile broadband interface for CDMA-based devices.
6769 Wwanpp2 ,
68- /// Transparent bridge interface
70+ /// Transparent bridge interface.
6971 Bridge ,
70- /// Controller Area Network
72+ /// Controller Area Network (CAN) interface.
7173 Can ,
72- /// Peer-to-Peer Wireless ( Wi-Fi Direct / AWDL)
74+ /// Peer-to-peer wireless interface, such as Wi-Fi Direct or AWDL.
7375 PeerToPeerWireless ,
74- /// Unknown interface type with a specific value
76+ /// Unrecognized platform-specific type value.
7577 UnknownWithValue ( u32 ) ,
7678}
7779
7880impl InterfaceType {
79- /// Returns OS-specific value of InterfaceType
81+ /// Returns the native numeric type identifier for the current target platform.
82+ ///
83+ /// For variants that have no direct mapping on the current platform, this method returns
84+ /// `u32::MAX`.
8085 #[ cfg( target_os = "windows" ) ]
8186 pub fn value ( & self ) -> u32 {
8287 match * self {
@@ -113,7 +118,10 @@ impl InterfaceType {
113118 _ => u32:: MAX ,
114119 }
115120 }
116- /// Returns OS-specific value of InterfaceType
121+ /// Returns the native numeric type identifier for the current target platform.
122+ ///
123+ /// For variants that have no direct mapping on the current platform, this method returns
124+ /// `u32::MAX`.
117125 #[ cfg( any( target_os = "linux" , target_os = "android" ) ) ]
118126 pub fn value ( & self ) -> u32 {
119127 use crate :: os:: linux:: arp;
@@ -136,7 +144,10 @@ impl InterfaceType {
136144 _ => u32:: MAX ,
137145 }
138146 }
139- /// Returns OS-specific value of InterfaceType
147+ /// Returns the native numeric type identifier for the current target platform.
148+ ///
149+ /// For variants that have no direct mapping on the current platform, this method returns
150+ /// `u32::MAX`.
140151 #[ cfg( any(
141152 target_vendor = "apple" ,
142153 target_os = "openbsd" ,
@@ -166,7 +177,7 @@ impl InterfaceType {
166177 _ => u32:: MAX ,
167178 }
168179 }
169- /// Returns name of InterfaceType
180+ /// Returns a human-readable name for the interface type.
170181 pub fn name ( & self ) -> String {
171182 match * self {
172183 InterfaceType :: Unknown => String :: from ( "Unknown" ) ,
0 commit comments