]> code.octet-stream.net Git - netwatcher/blob - examples/watch.rs
Add top-level docs and update README
[netwatcher] / examples / watch.rs
1 use std::time::Duration;
2
3 fn main() {
4 println!("Watching for changes for 30 seconds...");
5
6 let handle = netwatcher::watch_interfaces(|update| {
7 println!("Interface update!");
8 println!("State: {:#?}", update.interfaces);
9 println!("Diff: {:#?}", update.diff);
10 });
11
12 std::thread::sleep(Duration::from_secs(30));
13
14 drop(handle);
15 println!("Stopped watching! Program will end in 30 seconds.");
16
17 std::thread::sleep(Duration::from_secs(30));
18 }