Seregon/StratoSDK

StratoSDK is a framework with a declarative approach similar to Flutter/React, written and designed entirely for Rust.

Rust/27.3 KB/No license
crates/strato-ui-renderer/src/platform/mod.rs
1pub mod app;
2#[cfg(target_os = "linux")]
3pub mod linux;
4#[cfg(target_os = "macos")]
5pub mod mac;
6#[cfg(target_family = "wasm")]
7pub mod wasm;
8#[cfg(target_os = "windows")]
9pub mod windows;
10 
11pub mod headless;
12 
13pub mod current {
14 cfg_if::cfg_if! {
15 if #[cfg(target_family = "wasm")] {
16 pub use super::wasm::*;
17 } else if #[cfg(target_os = "linux")] {
18 pub use super::linux::*;
19 } else if #[cfg(target_os = "macos")] {
20 pub use super::mac::*;
21 } else if #[cfg(target_os = "windows")] {
22 pub use super::windows::*;
23 } else {
24 pub use strato_ui_core::platform::test::*;
25 }
26 }
27}
28 
29pub use strato_ui_core::platform::*;
30 
31pub use app::AppBuilder;
32 
33/// Returns whether the current device is a mobile device with touch input.
34///
35/// This is a cross-platform wrapper around the platform-specific implementation.
36pub fn is_mobile_device() -> bool {
37 #[cfg(target_family = "wasm")]
38 {
39 wasm::is_mobile_device()
40 }
41 #[cfg(not(target_family = "wasm"))]
42 {
43 false
44 }
45}
46 
47/// A trait for accessing internal per-platform concrete implementations
48/// through a wrapper type.
49#[allow(dead_code)]
50trait AsInnerMut<Inner: ?Sized> {
51 fn as_inner_mut(&mut self) -> &mut Inner;
52}
53