]> code.octet-stream.net Git - netwatcher/blobdiff - examples/watch.rs
First go at a Windows watch implementation
[netwatcher] / examples / watch.rs
diff --git a/examples/watch.rs b/examples/watch.rs
new file mode 100644 (file)
index 0000000..4129dc6
--- /dev/null
@@ -0,0 +1,13 @@
+use std::time::Duration;
+
+fn main() {
+    let _handle = netwatcher::watch_interfaces(|update| {
+        println!("Interface update!");
+        println!("State: {:?}", update.interfaces);
+        println!("Diff: {:?}", update.diff);
+    });
+
+    loop {
+        std::thread::sleep(Duration::from_secs(60));
+    }
+}