wasma_sys/lib.rs
1// WASMA - Windows Assignment System Monitoring Architecture
2// lib.rs — Crate Root
3// Tüm modülleri birleştiren ve public API'yi dışa açan ana giriş noktası.
4// Ocak–Şubat 2026
5
6#![doc = include_str!("../README.md")]
7#![warn(missing_docs)]
8#![warn(rust_2018_idioms)]
9#![allow(unused)]
10#![allow(warnings)]
11#![cfg_attr(not(unix), allow(unused_imports))]
12
13// ============================================================================
14// EXTERNAL CRATE IMPORTS
15// ============================================================================
16
17#[cfg(feature = "async")]
18extern crate tokio;
19
20#[cfg(feature = "serde")]
21extern crate serde;
22
23#[cfg(feature = "config-toml")]
24extern crate toml;
25
26#[cfg(feature = "anyhow")]
27extern crate anyhow;
28
29#[cfg(feature = "x11")]
30extern crate xcb;
31
32#[cfg(feature = "wayland")]
33extern crate wayland_client;
34
35#[cfg(feature = "wgpu")]
36extern crate wgpu;
37
38#[cfg(feature = "toolkit-iced")]
39extern crate iced;
40
41#[cfg(feature = "toolkit-gtk4")]
42extern crate gtk4;
43
44#[cfg(feature = "opencl")]
45extern crate ocl;
46
47// ============================================================================
48// CORE MODULES
49// ============================================================================
50
51/// Yapılandırma dosyası ayrıştırıcısı ve WasmaConfig tanımı.
52/// `wasma.in.conf` formatını okur, varsayılan config üretir.
53pub use wasma_client::parser;
54
55/// UClient (Universal Client) — temel veri akışı ve SectionMemory yönetimi.
56/// Tüm istemci motorlarının ortak bellek altyapısını sağlar.
57pub use wasma_client::uclient;
58
59/// WindowClient — rendering ve viewport yönetimi.
60/// RawWindowClient ile PosixWindowLauncher tarafından kullanılır.
61pub use wasma_client::window_client;
62
63/// Pencere yönetimi tipleri ve yapıları.
64/// WindowGeometry, WindowState, WindowType, ResourceLimits, PermissionScope.
65pub use wasma_client::window_handling;
66
67// ============================================================================
68// POSIX RAW CLIENT MODULES
69// ============================================================================
70
71/// Raw POSIX Uygulama Veri Erişim İstemcisi.
72///
73/// POSIX fd (`read()`) tabanlı veri akışı motoru.
74/// [`UClientEngine`] trait'ini implement eder.
75/// Ping-pong çift tampon, NULL_EXCEPTION (scope_level=0) ve
76/// bölümlenmiş mod desteklenir.
77///
78/// Ana tipler:
79/// - [`wasma_client_unix_posix_raw_app::RawAppClient`]
80/// - [`wasma_client_unix_posix_raw_app::RawAppDescriptor`]
81/// - [`wasma_client_unix_posix_raw_app::RawAppSource`]
82/// - [`wasma_client_unix_posix_raw_app::UClientEngine`] (trait)
83/// - [`wasma_client_unix_posix_raw_app::posix`] (alt modül)
84#[cfg(unix)]
85pub mod wasma_client_unix_posix_raw_app;
86
87/// Raw POSIX Applet Letting İstemcisi.
88///
89/// Applet ↔ Host iletişimi için reaktif letting protokolü.
90/// Sabit 20 byte başlık + değişken payload (LETL/LRSP magic).
91/// [`UClientEngine`]'den bağımsızdır — sadece letting protokolü.
92///
93/// Ana tipler:
94/// - [`wasma_client_unix_posix_raw_applettel::ApplettelClient`]
95/// - [`wasma_client_unix_posix_raw_applettel::AppletDescriptor`]
96/// - [`wasma_client_unix_posix_raw_applettel::AppletKind`]
97/// - [`wasma_client_unix_posix_raw_applettel::FieldKey`]
98/// - [`wasma_client_unix_posix_raw_applettel::LettingEvent`]
99#[cfg(unix)]
100pub mod wasma_client_unix_posix_raw_applettel;
101
102/// Raw POSIX Pencere Yönetim İstemcisi.
103///
104/// Pencere yönetimini POSIX fd üzerinden ham olarak yürütür.
105/// Rendering [`window_client::WindowClient`]'a delege edilir.
106/// [`UClientEngine`] trait'ini implement eder.
107/// 16 byte WAWM/WRSP protokolü.
108///
109/// Ana tipler:
110/// - [`wasma_client_unix_posix_raw_window::RawWindowClient`]
111/// - [`wasma_client_unix_posix_raw_window::RawWindowRecord`]
112/// - [`wasma_client_unix_posix_raw_window::RawWindowFd`]
113/// - [`wasma_client_unix_posix_raw_window::geometry_codec`]
114/// - [`wasma_client_unix_posix_raw_window::state_codec`]
115#[cfg(unix)]
116pub mod wasma_client_unix_posix_raw_window;
117
118// ============================================================================
119// UNIVERSAL PROTOCOL MODULES
120// ============================================================================
121
122/// Evrensel POSIX Pencere İstemcisi — Platform-agnostik.
123///
124/// Compile-time mimari dispatch (`#[cfg(target_arch)]`) ile
125/// x86_64, AArch64, RISC-V 64, OpenRISC, PowerPC 64, SPARC 64
126/// ve SISD (kısmi) desteklenir.
127///
128/// Ana tipler:
129/// - [`wasma_protocol_universal_client_unix_posix_window::UniversalClient`]
130/// - [`wasma_protocol_universal_client_unix_posix_window::ArchKind`]
131/// - [`wasma_protocol_universal_client_unix_posix_window::ArchBackend`]
132/// - [`wasma_protocol_universal_client_unix_posix_window::UniversalWindowOps`]
133/// - [`wasma_protocol_universal_client_unix_posix_window::UniversalTransport`]
134/// - [`wasma_protocol_universal_client_unix_posix_window::CURRENT_ARCH`] (sabit)
135#[cfg(unix)]
136pub mod wasma_protocol_universal_client_unix_posix_window;
137
138/// POSIX Pencere Çizim Dönüşüm Yöneticisi.
139///
140/// Koordinat sistemi dönüşümleri: mantıksal piksel, fiziksel piksel,
141/// DPI normalize, noktalar (pt), milimetre.
142/// Pipeline (A→B→C) ve doğrudan tek adım dönüşüm desteklenir.
143/// Soft (CPU) ve donanım hızlandırmalı (mimari dispatch) motorlar.
144///
145/// Ana tipler:
146/// - [`wasma_protocol_unix_posix_conversion::ConversionManager`]
147/// - [`wasma_protocol_unix_posix_conversion::ConversionEngine`]
148/// - [`wasma_protocol_unix_posix_conversion::ConversionPipeline`]
149/// - [`wasma_protocol_unix_posix_conversion::DirectConverter`]
150/// - [`wasma_protocol_unix_posix_conversion::DpiProfile`]
151/// - [`wasma_protocol_unix_posix_conversion::CoordSpace`]
152pub mod wasma_protocol_unix_posix_conversion;
153
154/// POSIX Optionalty Yapılandırması.
155///
156/// Tüm isteğe bağlı WASMA pencere çizim ve render ayarları.
157/// Gruplar: [`DrawOpt`], [`PixelOpt`], [`XlinxOpt`], [`BackendOpt`].
158/// Builder pattern + thread-safe runtime override ([`RuntimeOptStore`]).
159///
160/// [`DrawOpt`]: wasma_protocol_unix_posix_opt::DrawOpt
161/// [`PixelOpt`]: wasma_protocol_unix_posix_opt::PixelOpt
162/// [`XlinxOpt`]: wasma_protocol_unix_posix_opt::XlinxOpt
163/// [`BackendOpt`]: wasma_protocol_unix_posix_opt::BackendOpt
164/// [`RuntimeOptStore`]: wasma_protocol_unix_posix_opt::RuntimeOptStore
165///
166/// Ana tipler:
167/// - [`wasma_protocol_unix_posix_opt::PosixOpt`]
168/// - [`wasma_protocol_unix_posix_opt::PosixOptBuilder`]
169/// - [`wasma_protocol_unix_posix_opt::RuntimeOptStore`]
170/// - [`wasma_protocol_unix_posix_opt::DisplayBackend`]
171/// - [`wasma_protocol_unix_posix_opt::XlinxArch`]
172/// - [`wasma_protocol_unix_posix_opt::RasterMode`]
173pub mod wasma_protocol_unix_posix_opt;
174
175/// Normal (ham olmayan) POSIX Pencere Başlatma Protokolü.
176///
177/// Manifest/config tabanlı ve runtime API başlatmayı destekler.
178/// Pencere modu: Singularity (tekli) veya Multitary (çoklu).
179/// [`UClientEngine`] implement eder.
180/// [`PosixOpt`] her başlatmada otomatik uygulanır.
181///
182/// [`PosixOpt`]: wasma_protocol_unix_posix_opt::PosixOpt
183///
184/// Ana tipler:
185/// - [`wasma_protocol_unix_posix_window::PosixWindowLauncher`]
186/// - [`wasma_protocol_unix_posix_window::PosixWindowLauncherBuilder`]
187/// - [`wasma_protocol_unix_posix_window::WindowSpec`]
188/// - [`wasma_protocol_unix_posix_window::WindowSpecBuilder`]
189/// - [`wasma_protocol_unix_posix_window::PosixWindow`]
190/// - [`wasma_protocol_unix_posix_window::WindowMode`]
191#[cfg(unix)]
192pub mod wasma_protocol_unix_posix_window;
193
194// ============================================================================
195// WINDOW ESCAPE / SHIFTMASKING MODULES
196// ============================================================================
197
198/// POSIX Pencere Escape — ShiftMasking Protokolü.
199///
200/// Yalnızca UNIX/POSIX uyumlu cihazlar için.
201/// **64-bit:** tam destek (XOR + BitRotation + PolynomialHash + LFSR).
202/// **32-bit:** yarı kısıtlı (LFSR devre dışı, 32-bit rotation).
203///
204/// Ana tipler:
205/// - [`wasma_protocol_unix_posix_windowesc::PosixWindowEsc`]
206/// - [`wasma_protocol_unix_posix_windowesc::ShiftMaskEngine`]
207/// - [`wasma_protocol_unix_posix_windowesc::ShiftMaskKey`]
208/// - [`wasma_protocol_unix_posix_windowesc::ShiftMaskAlgo`]
209/// - [`wasma_protocol_unix_posix_windowesc::WindowIdEscaper`]
210/// - [`wasma_protocol_unix_posix_windowesc::StreamEscaper`]
211/// - [`wasma_protocol_unix_posix_windowesc::PlatformWidth`]
212#[cfg(unix)]
213pub mod wasma_protocol_unix_posix_windowesc;
214
215/// Unixverse Pencere Escape — AVAX ShiftMasking Protokolü.
216///
217/// Tüm platformlar için, POSIX olmayan cihazlar dahil.
218/// **32-bit:** TAM destek (kısıtlama yok).
219/// **64-bit:** TAM destek.
220/// AVAX (Adaptive Vectorized Accumulative XOR-shift) — unixverse'e özel algoritma.
221/// `wasma_protocol_unix_posix_windowesc`'den tamamen bağımsızdır.
222///
223/// Ana tipler:
224/// - [`wasma_protocol_unixverse_windowesc::UniverseWindowEsc`]
225/// - [`wasma_protocol_unixverse_windowesc::UniverseEngine`]
226/// - [`wasma_protocol_unixverse_windowesc::UniverseKey`]
227/// - [`wasma_protocol_unixverse_windowesc::UniverseAlgo`]
228/// - [`wasma_protocol_unixverse_windowesc::AvaxEngine`]
229/// - [`wasma_protocol_unixverse_windowesc::UniverseWindowIdEscaper`]
230/// - [`wasma_protocol_unixverse_windowesc::UniverseStreamEscaper`]
231/// - [`wasma_protocol_unixverse_windowesc::UniverseWidth`]
232pub mod wasma_protocol_unixverse_windowesc;
233
234// ============================================================================
235// PUBLIC API RE-EXPORTS — En sık kullanılan tipler doğrudan erişilebilir
236// ============================================================================
237
238// --- Config ---
239pub use parser::{ConfigParser, WasmaConfig};
240
241// --- UClient Engine trait (tüm istemcilerin ortak arayüzü) ---
242#[cfg(unix)]
243pub use wasma_client_unix_posix_raw_app::UClientEngine;
244
245// --- Pencere tipleri ---
246pub use window_handling::{WindowGeometry, WindowState, WindowType};
247
248// --- Mimari bilgisi ---
249#[cfg(unix)]
250pub use wasma_protocol_universal_client_unix_posix_window::{ArchKind, CURRENT_ARCH};
251
252// --- Dönüşüm yöneticisi ---
253pub use wasma_protocol_unix_posix_conversion::{ConversionManager, CoordSpace, DpiProfile};
254
255// --- Optionalty ---
256pub use wasma_protocol_unix_posix_opt::{
257 DisplayBackend, PosixOpt, PosixOptBuilder, RuntimeOptStore,
258};
259
260// --- Pencere başlatıcı ---
261#[cfg(unix)]
262pub use wasma_protocol_unix_posix_window::{
263 PosixWindowLauncher, PosixWindowLauncherBuilder, WindowMode, WindowSpec,
264};
265
266// --- ShiftMask (POSIX) ---
267#[cfg(unix)]
268pub use wasma_protocol_unix_posix_windowesc::{PosixWindowEsc, ShiftMaskAlgo, ShiftMaskKey};
269
270// --- ShiftMask (Unixverse/AVAX) ---
271pub use wasma_protocol_unixverse_windowesc::{UniverseAlgo, UniverseKey, UniverseWindowEsc};
272
273// ============================================================================
274// PRELUDE — Tek import ile temel API
275// ============================================================================
276
277/// WASMA prelude — en yaygın kullanılan tipleri tek seferde import eder.
278///
279/// ```rust
280/// use wasma_sys::prelude::*;
281/// ```
282pub mod prelude {
283 // Config
284 pub use crate::parser::{ConfigParser, WasmaConfig};
285
286 // Window tipleri
287 pub use crate::window_handling::{WindowGeometry, WindowState, WindowType};
288
289 // Dönüşüm
290 pub use crate::wasma_protocol_unix_posix_conversion::{
291 ConversionManager, ConversionPipeline, CoordSpace, DirectConverter, DpiProfile,
292 };
293
294 // Opt
295 pub use crate::wasma_protocol_unix_posix_opt::{
296 DisplayBackend, PosixOpt, PosixOptBuilder, RasterMode, RuntimeOptStore, ToolkitTheme,
297 XlinxArch,
298 };
299
300 // Unixverse ShiftMask (tüm platformlarda mevcut)
301 pub use crate::wasma_protocol_unixverse_windowesc::{
302 AvaxEngine, UniverseAlgo, UniverseKey, UniverseWindowEsc,
303 };
304
305 // POSIX'e özgü
306 #[cfg(unix)]
307 pub use crate::wasma_client_unix_posix_raw_app::{
308 RawAppClient, RawAppClientBuilder, RawAppSource, UClientEngine,
309 };
310
311 #[cfg(unix)]
312 pub use crate::wasma_client_unix_posix_raw_applettel::{
313 AppletDescriptor, AppletKind, ApplettelClient, ApplettelClientBuilder, EmbeddedAppletRole,
314 FieldKey, FieldValue, LettingEvent, SystemAppletRole,
315 };
316
317 #[cfg(unix)]
318 pub use crate::wasma_client_unix_posix_raw_window::{RawWindowClient, RawWindowClientBuilder};
319
320 #[cfg(unix)]
321 pub use crate::wasma_protocol_universal_client_unix_posix_window::{
322 ArchKind, UniversalClient, UniversalClientBuilder, CURRENT_ARCH,
323 };
324
325 #[cfg(unix)]
326 pub use crate::wasma_protocol_unix_posix_window::{
327 PosixWindowLauncher, PosixWindowLauncherBuilder, WindowMode, WindowSpec, WindowSpecBuilder,
328 };
329
330 #[cfg(unix)]
331 pub use crate::wasma_protocol_unix_posix_windowesc::{
332 PlatformWidth, PosixWindowEsc, ShiftMaskAlgo, ShiftMaskKey,
333 };
334}
335
336// ============================================================================
337// CRATE META
338// ============================================================================
339
340/// WASMA kütüphane sürümü.
341pub const VERSION: &str = env!("CARGO_PKG_VERSION");
342
343/// WASMA mimari adı (compile-time).
344#[cfg(unix)]
345pub const ARCH_NAME: &str = "unix";