Crate udisks2

Source
Expand description

§Udisks

An unofficial Rust client crate for udisks2. Udisks allows accessing and manipulating disks, storages devices and similar technologies.

§Version

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.

§Example

// 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(())
}

§Documentation

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.

§Internationalization

This crate uses the same localization as UDisks2, which uses gettext. If the locale is left unset, English will be used.

Re-exports§

pub use zbus;

Modules§

ata
DBus interface proxy for: org.freedesktop.UDisks2.Drive.Ata
block
Interface to represent a block device.
drive
Interface to represent both hard disks and disk drives (with or without removable media).
encrypted
DBus interface proxy for: org.freedesktop.UDisks2.Encrypted
filesystem
DBus interface proxy for: org.freedesktop.UDisks2.Filesystem
job
DBus interface proxy for: org.freedesktop.UDisks2.Job
loop
DBus interface proxy for: org.freedesktop.UDisks2.Loop
manager
DBus interface proxy for: org.freedesktop.UDisks2.Manager
mdraid
DBus interface proxy for: org.freedesktop.UDisks2.MDRaid
nvme
DBus interface proxy for: org.freedesktop.UDisks2.Manager.NVMe
partition
Block device representing a partition.
partition_types
partitiontable
DBus interface proxy for: org.freedesktop.UDisks2.PartitionTable
swapspace
DBus interface proxy for: org.freedesktop.UDisks2.Swapspace

Structs§

Client
Utility routines for accessing the UDisks service.
Object
Utility struct for easily accessing interfaces.
ObjectInfo
Detailed information about the D-Bus interfaces (such as block::BlockProxy and drive::DriveProxy) on a Object that is suitable to display in an user interface.

Enums§

Error
The error type for UDisks2.
Iscsi

Functions§

standard_options
Standard Options.

Type Aliases§

Result
Alias for a Result with the error type Error.