ruabmbua / hidapi-rs

Rust bindings for the hidapi C library
MIT License
177 stars 82 forks source link

Add `PartialEq`, `Eq` and `Hash` to `DeviceInfo` #154

Open alvaro-cuesta opened 6 months ago

alvaro-cuesta commented 6 months ago

Also added transitively to BusType and WcharString. As far as I can tell this is safe to do since their equality relation is total.

A simple change for consumer QoL. I am trying to poll the list of devices and need this to track changes on the list of devices (libusb hotplug is not yet available in Windows, so I have to resort to polling, and I have to use HID anyways).

I didn't particularly need hash (yet) but it felt right to add it semantically, and I can foresee me using the DeviceInfo in HashSet or HashMap at some point.