systemconfiguration-rs 0.5.3

Safe Rust bindings for Apple's SystemConfiguration framework via a Swift bridge on macOS
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
use systemconfiguration::Preferences;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let prefs = Preferences::new("systemconfiguration-rs.network-services-example", None)?;
    for service in prefs.network_services() {
        println!(
            "id={:?} enabled={} name={:?} protocols={}",
            service.service_id()?,
            service.is_enabled(),
            service.name()?,
            service.copy_protocols().len()
        );
    }
    Ok(())
}