1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
//! Interface change notifier example.

#[cfg(not(any(target_os = "macos", target_os = "ios")))]
fn main() {
    let mut if_change_notifier = if_addrs::IfChangeNotifier::new().unwrap();
    println!("Waiting for interface changes...");
    loop {
        if let Ok(details) = if_change_notifier.wait(None) {
            println!("Network interfaces changed: {:#?}", details);
        }
    }
}

#[cfg(any(target_os = "macos", target_os = "ios"))]
fn main() {
    panic!("Interface change API is not implemented for macOS or iOS");
}