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
16
use systemconfiguration::Preferences;

fn main() -> Result<(), Box<dyn std::error::Error>> {
    let prefs = Preferences::new("systemconfiguration-rs.preferences-example", None)?;
    let keys = prefs.copy_key_list();
    println!("key_count={}", keys.len());
    if let Some(first_key) = keys.first() {
        println!("first_key={first_key}");
        println!(
            "first_value_present={}",
            prefs.get_value(first_key)?.is_some()
        );
    }
    println!("signature_present={}", prefs.signature().is_some());
    Ok(())
}