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