16 breaking releases
new 0.17.0 | Nov 24, 2024 |
---|---|
0.16.0 | Mar 17, 2024 |
0.15.0 | Aug 3, 2023 |
0.14.0 | Feb 17, 2023 |
0.1.1 | Nov 30, 2016 |
#470 in Hardware support
99 downloads per month
Used in gnome-egpu
47KB
1K
SLoC
gudev
gudev
is a crate that provide Rust idiomatic bindings for GUDev.
It follows the release of glib-rs.
To use in your project, just add gudev = "^0.11.0"
to your Cargo.toml.
Please file issues at:
https://github.com/hfiguiere/gudev-rs/
The latest autogenerated online documentation is at:
lib.rs
:
Rust bindings for the gudev library.
Libgudev is a library providing GObject bindings for libudev.
Usage
Add the following to your Cargo.toml
:
[dependencies]
gudev = "0.12"
Next:
use gudev::prelude::*;
use gudev::Client;
use gudev::Device;
fn main() {
// Get a list of all block devices
let devices = Client::new(&[]).query_by_subsystem(Some("block"));
for device in devices {
print_device(&device);
}
}
fn print_device(device: &Device) {
println!(
"{} (subsystem={}, sysname={}, devtype={})",
device.sysfs_path().unwrap_or_else(|| "---".into()),
device.subsystem().unwrap_or_else(|| "---".into()),
device.device_file().unwrap_or_else(|| "---".into()),
device.devtype().unwrap_or_else(|| "---".into()),
);
}
Dependencies
~5.5MB
~119K SLoC