Skip to main content

lingxia_platform/
lib.rs

1//! LingXia Platform
2//!
3//! This crate provides the platform-specific implementation for LingXia.
4
5use std::io::Read;
6
7/// Asset file entry with reader for streaming content
8pub struct AssetFileEntry<'a> {
9    pub path: String,
10    pub reader: Box<dyn Read + 'a>,
11}
12
13/// Device information
14#[derive(Debug, Clone)]
15pub struct DeviceInfo {
16    pub brand: String,
17    pub model: String,
18    pub market_name: String,
19    pub os_name: String,
20    pub os_version: String,
21}
22
23/// Screen information reported in logical pixels (dp/pt) and scale factor
24#[derive(Debug, Clone, serde::Serialize)]
25pub struct ScreenInfo {
26    pub width: f64,
27    pub height: f64,
28    pub scale: f64,
29}
30
31pub(crate) mod rt;
32pub mod traits;
33
34#[cfg(target_os = "android")]
35mod android;
36
37#[cfg(any(target_os = "ios", target_os = "macos"))]
38mod apple;
39
40#[cfg(target_env = "ohos")]
41pub mod harmony;
42
43#[cfg(any(target_os = "macos", target_os = "windows"))]
44pub mod desktop;
45
46#[cfg(target_os = "android")]
47pub use android::{
48    CachedClass, Platform, get_android_id, get_api_level, get_system_property,
49    has_telephony_feature, init_cached_class, initialize_jni, read_external_storage_text,
50    write_external_storage_text,
51};
52
53#[cfg(any(target_os = "ios", target_os = "macos"))]
54pub use apple::Platform;
55
56#[cfg(target_env = "ohos")]
57pub use harmony::Platform;
58
59pub mod error;
60pub use error::*;