Skip to main content

euv_core/platform/info/
enum.rs

1/// All supported execution targets across Web, Mobile, Tablet, Desktop, HarmonyOS, Wearables, Mini-Programs, QuickApps, Terminal, and Headless.
2#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
3pub enum PlatformKind {
4    /// Browser WebAssembly platform using HTML5 Canvas / WebGL2 / WebGPU.
5    Web,
6    /// Android native platform using Android NDK (`ANativeWindow` / `AInput` / Vulkan / GLES).
7    Android,
8    /// iOS phone native platform using UIKit / CoreGraphics / Metal.
9    Ios,
10    /// iPadOS tablet native platform using UIKit / Stage Manager / Apple Pencil / Metal.
11    IpadOs,
12    /// macOS desktop native platform using Cocoa AppKit / CoreGraphics / Metal.
13    MacOs,
14    /// Windows desktop native platform using Win32 / GDI32 / DWM / Direct3D.
15    Windows,
16    /// Linux desktop native platform using X11 / Wayland / Vulkan.
17    Linux,
18    /// HarmonyOS / OpenHarmony native platform using ArkUI XComponent / `OHNativeWindow` / NAPI / EGL / Vulkan.
19    HarmonyOs,
20    /// Smart wearable / smartwatch platform (Wear OS, watchOS, HarmonyOS Watch, HyperOS/Vela, ZeppOS).
21    Wearable,
22    /// Super-app Mini-Program runtime (WeChat, Alipay, Douyin, Baidu, QQ, Kuaishou, HarmonyOS Atomic Service).
23    MiniApp,
24    /// QuickApp Alliance and Huawei QuickApp native-like runtime.
25    QuickApp,
26    /// Interactive PTY Terminal TUI platform using character cell grid and ANSI/VT escapes.
27    Terminal,
28    /// Non-interactive static/pipe CLI platform writing clean UTF-8 output with exit code propagation.
29    TerminalCli,
30    /// Deterministic offscreen headless platform for automated parity tests and benchmarks.
31    #[default]
32    Headless,
33}
34
35/// Physical device form factor used for adaptive layout and input affordances.
36#[derive(Clone, Copy, Debug, Default, Eq, Hash, Ord, PartialEq, PartialOrd)]
37pub enum DeviceFormFactor {
38    /// Multi-window desktop workstation or 2-in-1 PC.
39    #[default]
40    Desktop,
41    /// Large-screen touch + stylus + optional keyboard tablet (e.g. iPadOS, HarmonyOS Tablet).
42    Tablet,
43    /// Compact handheld phone (iOS / Android / HarmonyOS Phone).
44    Phone,
45    /// Dual-state foldable mobile/tablet display with hinge transition support.
46    Foldable,
47    /// Compact wrist wearable / smartwatch display (round, squircle, or rectangular).
48    Watch,
49    /// Living-room Smart TV / Vision display driven by 10-foot focus and remote D-pad.
50    Tv,
51    /// In-vehicle cockpit / automotive infotainment display.
52    Automotive,
53    /// Super-app Mini-Program or QuickApp container with capsule navigation chrome.
54    MiniProgram,
55    /// Web browser viewport.
56    Browser,
57    /// Interactive PTY terminal or non-interactive CLI pipe.
58    Terminal,
59    /// Offscreen headless test host.
60    Headless,
61}
62
63/// Zero-dependency ABI-stable native OS window handle for GPU surface creation.
64#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
65pub enum RawWindowHandle {
66    /// macOS AppKit handle carrying `(ns_window, ns_view, ca_metal_layer)` pointers.
67    AppKit {
68        /// Pointer to `NSWindow`.
69        ns_window: usize,
70        /// Pointer to `NSView`.
71        ns_view: usize,
72        /// Pointer to `CAMetalLayer`.
73        metal_layer: usize,
74    },
75    /// iOS / iPadOS UIKit handle carrying `(ui_window, ui_view, ca_metal_layer, is_ipad)`.
76    UiKit {
77        /// Pointer to `UIWindow`.
78        ui_window: usize,
79        /// Pointer to `UIView`.
80        ui_view: usize,
81        /// Pointer to `CAMetalLayer`.
82        metal_layer: usize,
83        /// True when running on iPadOS tablet idiom.
84        is_ipad: bool,
85    },
86    /// Windows Win32 handle carrying `(hwnd, hinstance)`.
87    Win32 {
88        /// Win32 `HWND` window handle.
89        hwnd: usize,
90        /// Win32 `HINSTANCE` module handle.
91        hinstance: usize,
92    },
93    /// Linux X11 Xlib handle carrying `(window, display)`.
94    Xlib {
95        /// X11 `Window` identifier.
96        window: u64,
97        /// X11 `Display*` pointer.
98        display: usize,
99    },
100    /// Linux Wayland handle carrying `(wl_surface, wl_display)`.
101    Wayland {
102        /// Pointer to `wl_surface`.
103        surface: usize,
104        /// Pointer to `wl_display`.
105        display: usize,
106    },
107    /// Android NDK handle carrying `ANativeWindow*`.
108    AndroidNdk {
109        /// Pointer to `ANativeWindow`.
110        native_window: usize,
111    },
112    /// HarmonyOS / OpenHarmony ArkUI XComponent surface carrying `(OHNativeWindow*, OH_NativeXComponent*)`.
113    HarmonyXComponent {
114        /// Pointer to `OHNativeWindow`.
115        native_window: usize,
116        /// Pointer to `OH_NativeXComponent`.
117        xcomponent: usize,
118    },
119    /// Smartwatch native surface handle carrying `(native_handle, vendor_tag)`.
120    WearableSurface {
121        /// Opaque vendor surface handle pointer.
122        native_handle: usize,
123        /// Encoded `WearableVendor` discriminant tag.
124        vendor_tag: u8,
125    },
126    /// Web browser canvas element identifier.
127    WebCanvas {
128        /// Canvas registration identifier.
129        canvas_id: u32,
130    },
131    /// Mini-Program or QuickApp canvas handle carrying `(canvas_id, vendor_tag)`.
132    MiniAppCanvas {
133        /// Host canvas registration identifier.
134        canvas_id: u32,
135        /// Encoded host vendor tag.
136        vendor_tag: u8,
137    },
138    /// Terminal PTY file descriptor or console handle.
139    TerminalPty {
140        /// Underlying terminal file descriptor (`0`/`1` on Unix, console handle low bits on Windows).
141        fd: i32,
142        /// True when attached to an interactive TTY/PTY rather than a pipe.
143        is_tty: bool,
144    },
145    /// Offscreen headless surface with no OS window handle.
146    #[default]
147    Headless,
148}