Files
galaxy/crates/galaxyui/src/platform/mod.rs
T

52 lines
1.3 KiB
Rust

pub mod app;
#[cfg(any(target_os = "linux", target_os = "freebsd"))]
pub mod linux;
#[cfg(target_os = "macos")]
pub mod mac;
#[cfg(target_family = "wasm")]
pub mod wasm;
#[cfg(target_os = "windows")]
pub mod windows;
pub mod headless;
pub mod current {
cfg_if::cfg_if! {
if #[cfg(target_family = "wasm")] {
pub use super::wasm::*;
} else if #[cfg(any(target_os = "linux", target_os = "freebsd"))] {
pub use super::linux::*;
} else if #[cfg(target_os = "macos")] {
pub use super::mac::*;
} else if #[cfg(target_os = "windows")] {
pub use super::windows::*;
} else {
pub use galaxyui_core::platform::test::*;
}
}
}
pub use app::AppBuilder;
pub use galaxyui_core::platform::*;
/// Returns whether the current device is a mobile device with touch input.
///
/// This is a cross-platform wrapper around the platform-specific implementation.
pub fn is_mobile_device() -> bool {
#[cfg(target_family = "wasm")]
{
wasm::is_mobile_device()
}
#[cfg(not(target_family = "wasm"))]
{
false
}
}
/// A trait for accessing internal per-platform concrete implementations
/// through a wrapper type.
#[allow(dead_code)]
trait AsInnerMut<Inner: ?Sized> {
fn as_inner_mut(&mut self) -> &mut Inner;
}