systemconfiguration-rs 0.2.1

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
use systemconfiguration::{NetworkService, Preferences};

#[test]
fn network_protocols_expose_metadata() -> Result<(), Box<dyn std::error::Error>> {
    let prefs = Preferences::new("systemconfiguration-rs.network-protocol-tests", None)?;
    let services = NetworkService::copy_all(&prefs);
    if let Some(protocol) = services.first().and_then(|service| service.copy_protocols().into_iter().next()) {
        let _ = protocol.protocol_type();
        let _ = protocol.is_enabled();
        let _ = protocol.configuration();
    }
    Ok(())
}