iohidmanager 0.8.0

Safe Rust bindings for Apple's IOKit HID — enumerate, inspect, and subscribe to HID devices on macOS
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
use iohidmanager::prelude::*;

#[test]
fn device_multi_value_roundtrip() {
    let manager = HidManager::new().expect("manager");
    manager.set_device_matching(None).expect("matching");
    let devices = manager.live_devices();
    let Some(device) = devices.first() else {
        return;
    };
    let _removal = devices.iter().find_map(|candidate| candidate.on_removal(|| {}).ok());
    let values = device.copy_value_multiple(&[]).expect("copy multiple");
    assert!(values.is_empty());
}