#![cfg_attr(docsrs, feature(doc_cfg))]
#![deny(rustdoc::broken_intra_doc_links)]
#![deny(missing_docs)]
#![doc(
html_logo_url = "https://raw.githubusercontent.com/bilelmoussaoui/ashpd/master/ashpd-demo/data/icons/com.belmoussaoui.ashpd.demo.svg",
html_favicon_url = "https://raw.githubusercontent.com/bilelmoussaoui/ashpd/master/ashpd-demo/data/icons/com.belmoussaoui.ashpd.demo-symbolic.svg"
)]
#![doc = include_str!("../README.md")]
#[cfg(all(all(feature = "tokio", feature = "async-std"), not(doc)))]
compile_error!("You can't enable both async-std & tokio features at once");
pub type Result<T> = std::result::Result<T, Error>;
static IS_SANDBOXED: OnceLock<bool> = OnceLock::new();
mod activation_token;
pub mod desktop;
pub mod documents;
mod error;
mod window_identifier;
pub use self::{activation_token::ActivationToken, window_identifier::WindowIdentifier};
mod app_id;
pub use self::app_id::AppID;
mod file_path;
pub use self::file_path::FilePath;
mod proxy;
#[cfg(feature = "backend")]
#[cfg_attr(docsrs, doc(cfg(feature = "backend")))]
pub use self::window_identifier::WindowIdentifierType;
#[cfg(feature = "backend")]
#[cfg_attr(docsrs, doc(cfg(feature = "backend")))]
#[allow(missing_docs)]
pub mod backend;
pub mod flatpak;
mod helpers;
use std::sync::OnceLock;
#[cfg(feature = "backend")]
#[cfg_attr(docsrs, doc(cfg(feature = "backend")))]
pub use async_trait;
pub use enumflags2;
pub use url;
pub use zbus::{self, zvariant};
pub async fn is_sandboxed() -> bool {
if let Some(cached_value) = IS_SANDBOXED.get() {
return *cached_value;
}
let new_value = crate::helpers::is_flatpak().await
|| crate::helpers::is_snap().await
|| std::env::var("GTK_USE_PORTAL")
.map(|v| v == "1")
.unwrap_or(false);
*IS_SANDBOXED.get_or_init(|| new_value)
}
pub use self::error::{Error, PortalError};
mod sealed {
pub trait Sealed {}
}
pub(crate) use sealed::Sealed;
pub type Pid = u32;