Crates.io | udisks2 |
lib.rs | udisks2 |
version | 0.2.0 |
source | src |
created_at | 2024-02-15 17:03:45.951047 |
updated_at | 2024-12-01 18:55:13.419328 |
description | Unofficial crate for interacting with the UDisks2 API |
homepage | |
repository | https://github.com/FineFindus/udisks-rs |
max_upload_size | |
id | 1141349 |
size | 460,048 |
An unofficial Rust client crate for udisks2
.
Udisks allows accessing and manipulating disks, storages devices and similar technologies.
Based on https://github.com/storaged-project/udisks/commit/4b1250cdf5897391e449ca0ad3836598c3b00dad for the client and https://github.com/storaged-project/udisks/commit/3e499ea0248ee73043aedab834f32501019830a8 for the generated interfaces.
// we use tokio in this example, but you can use any runtime
#[tokio::main]
async fn main() -> udisks2::Result<()> {
let client = udisks2::Client::new().await?;
let object = client
.object("/org/freedesktop/UDisks2/block_devices/sda")
.expect("No sda device found");
let block = object.block().await?;
let drive = client.drive_for_block(&block).await?;
println!(
"Size: {}",
client.size_for_display(drive.size().await?, true, true)
);
Ok(())
}
While this crate provides documentation for the handwritten code, the generated types may be lacking. In this case it is recommended to use the official documentation.
This crate uses the same localization as UDisks2
, which uses gettext. If the locale is left unset, English will be used.