getdevices/
getdevices.rs

1extern crate pcap;
2
3fn main() {
4    // list all of the devices pcap tells us are available
5    for device in pcap::Device::list().unwrap() {
6        println!("Found device! {:?}", device);
7
8        // now you can create a Capture with this Device if you want.
9        let mut cap = device.open().unwrap();
10
11        // get a packet from this capture
12        let packet = cap.next();
13
14        println!("got a packet! {:?}", packet);
15    }
16}