udisks2 0.3.1

Unofficial crate for interacting with the UDisks2 API
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
#[tokio::main]
async fn main() -> udisks2::Result<()> {
    let client = udisks2::Client::new().await.unwrap();
    let block = client
        .object("/org/freedesktop/UDisks2/block_devices/loop0") // has no Drive (the Drive property is '/')
        .unwrap()
        .block()
        .await
        .expect("can not create BlockProxy for loop0 block");

    assert!(block.drive().await.unwrap().as_ref() == "/");

    client
        .drive_for_block(&block)
        .await
        .expect("can not create Drive for loop0 block");
    Ok(())
}