]>
code.octet-stream.net Git - netwatcher/blob - examples/watch.rs
2f9539cfbb0b8dfdd075e1ebf4c1941f19558712
1 use std
::time
::Duration
;
4 println
!("Watching for changes for 30 seconds...");
6 let handle
= netwatcher
::watch_interfaces(|update
| {
7 println
!("Interface update!");
8 println
!("State: {:?}", update
.inter
faces
);
9 println
!("Diff: {:?}", update
.diff
);
12 std
::thread
::sleep(Duration
::from_secs(30));
15 println
!("Stopped watching! Program will end in 30 seconds.");
17 std
::thread
::sleep(Duration
::from_secs(30));