Skip to content

Commit a9b72be

Browse files
author
dlevy47
committed
Mention example in README.
1 parent 6e73fa1 commit a9b72be

File tree

1 file changed

+27
-0
lines changed

1 file changed

+27
-0
lines changed

README.md

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,30 @@
11
# Rust bindings to retrieve network interface information
22

33
This library contains functionality to retrieve network interface information on Linux machines.
4+
5+
## Example usage
6+
7+
See `src/bin/ifaces.rs`:
8+
9+
```rust
10+
extern crate "rust-ifaces" as ifaces;
11+
12+
fn main () {
13+
for iface in
14+
ifaces::Interface::get_all().unwrap()
15+
.into_iter()
16+
.filter(|x| x.kind == ifaces::Kind::Packet) {
17+
println!("{}", iface.name);
18+
}
19+
}
20+
```
21+
22+
On my machine, this prints out:
23+
24+
```
25+
$ target/ifaces
26+
lo
27+
eth0
28+
wlan0
29+
docker0
30+
```

0 commit comments

Comments
 (0)