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 system: String,
20}
21
22/// Screen information reported in logical pixels (dp/pt) and scale factor
23#[derive(Debug, Clone, serde::Serialize)]
24pub struct ScreenInfo {
25    pub width: f64,
26    pub height: f64,
27    pub scale: f64,
28}
29
30pub mod traits;
31
32#[cfg(target_os = "android")]
33mod android;
34
35#[cfg(any(target_os = "ios", target_os = "macos"))]
36mod apple;
37
38#[cfg(target_env = "ohos")]
39pub mod harmony;
40
41// Export Platform and Device types for each platform
42#[cfg(target_os = "android")]
43pub use android::{
44    CachedClass, Platform, get_android_id, get_api_level, has_telephony_feature, init_cached_class,
45};
46
47#[cfg(any(target_os = "ios", target_os = "macos"))]
48pub use apple::Platform;
49
50#[cfg(target_env = "ohos")]
51pub use harmony::Platform;
52
53pub mod error;
54// Re-export error types
55pub use error::*;