Module ashpd::documents

source ·
Expand description

Interact with the documents store or transfer files across apps.

§Examples

use ashpd::documents::{Documents, Permission};

async fn run() -> ashpd::Result<()> {
    let proxy = Documents::new().await?;

    println!("{:#?}", proxy.mount_point().await?);

    for (doc_id, host_path) in proxy.list(Some("org.mozilla.firefox".try_into()?)).await? {
        if doc_id == "f2ee988d".into() {
            let info = proxy.info(doc_id).await?;
            println!("{:#?}", info);
        }
    }

    proxy
        .grant_permissions(
            "f2ee988d",
            "org.mozilla.firefox".try_into().unwrap(),
            &[Permission::GrantPermissions],
        )
        .await?;
    proxy
        .revoke_permissions(
            "f2ee988d",
            "org.mozilla.firefox".try_into()?,
            &[Permission::Write],
        )
        .await?;

    proxy.delete("f2ee988d").await?;

    Ok(())
}

Structs§

  • The ID of a file in the document store.
  • The interface lets sandboxed applications make files from the outside world available to sandboxed applications in a controlled way.
  • The interface operates as a middle-man between apps when transferring files via drag-and-drop or copy-paste, taking care of the necessary exporting of files in the document portal.

Enums§

Type Aliases§