File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -3,7 +3,7 @@ https://crates.io/crates/if-addrs
33
44## Overview
55
6- Retrieve network interface info for all interfaces on the system.
6+ Retrieve network interface info for all interfaces on the system:
77
88``` rust
99// List all of the machine's network interfaces
@@ -12,9 +12,16 @@ for iface in if_addrs::get_if_addrs().unwrap() {
1212}
1313```
1414
15- ## Todo Items
15+ Get notifications for changes in network interfaces:
1616
17- * Create an API for responding to changes in network interfaces.
17+ ``` rust
18+ let mut notifier = if_addrs :: IfChangeNotifier :: new (). unwrap ();
19+ loop {
20+ if let Ok (details ) = notifier . wait (None ) {
21+ println! (" {:#?}" , details );
22+ }
23+ }
24+ ```
1825
1926## License
2027
Original file line number Diff line number Diff line change @@ -413,9 +413,8 @@ mod if_change_notifier {
413413 }
414414
415415 impl IfChangeNotifier {
416- /// Create a new interface change notifier Returns an
417- /// [`io::ErrorKind::WouldBlock`] error if the network notifier could
418- /// not be set up.
416+ /// Create a new interface change notifier. Returns an OS specific error
417+ /// if the network notifier could not be set up.
419418 pub fn new ( ) -> io:: Result < Self > {
420419 Ok ( Self {
421420 inner : InternalIfChangeNotifier :: new ( ) ?,
You can’t perform that action at this time.
0 commit comments