Skip to content

Commit f948092

Browse files
authored
Merge pull request #38 from mon/more-changes
Fix some IfChangeNotifier docs
2 parents adca042 + 4b1ea8d commit f948092

2 files changed

Lines changed: 12 additions & 6 deletions

File tree

README.md

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff 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

src/lib.rs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff 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()?,

0 commit comments

Comments
 (0)