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 mod traits;
32
33#[cfg(target_os = "android")]
34mod android;
35
36#[cfg(any(target_os = "ios", target_os = "macos"))]
37mod apple;
38
39#[cfg(target_env = "ohos")]
40pub mod harmony;
41
42#[cfg(any(target_os = "macos", target_os = "windows"))]
43pub mod desktop;
44
45#[cfg(target_os = "android")]
46pub use android::{
47    CachedClass, Platform, get_android_id, get_api_level, has_telephony_feature, init_cached_class,
48};
49
50#[cfg(any(target_os = "ios", target_os = "macos"))]
51pub use apple::Platform;
52
53#[cfg(target_env = "ohos")]
54pub use harmony::Platform;
55
56pub mod error;
57pub use error::*;