Skip to main content

euv_core/
lib.rs

1//! euv-core
2//!
3//! Core cross-platform runtime for euv featuring arena-based fine-grained reactivity,
4//! deterministic Flexbox/Grid layout, flat retained scene graph, multi-mode rendering
5//! (Auto, Software, Hardware, Hybrid), unified window abstractions, and direct OS API
6//! backends for Web, Android, iOS, iPadOS, macOS, Windows, and Linux.
7
8mod app;
9mod dynamic;
10mod font;
11mod game;
12mod layout;
13mod media;
14mod platform;
15mod reactive;
16mod render;
17mod scene;
18mod style;
19mod system;
20mod window;
21
22#[cfg(test)]
23#[path = "../tests/mod.rs"]
24mod tests;
25
26pub use {
27    app::*, dynamic::*, font::*, game::*, layout::*, media::*, platform::*, reactive::*, render::*,
28    scene::*, style::*, system::*, window::*,
29};
30
31#[cfg(target_os = "linux")]
32use std::env;
33#[cfg(any(target_os = "macos", target_os = "ios", target_os = "linux"))]
34use std::ffi::CStr;
35#[cfg(unix)]
36use std::ffi::CString;
37#[cfg(unix)]
38use std::ffi::c_char;
39#[cfg(any(unix, windows))]
40use std::ffi::c_void;
41#[cfg(target_os = "windows")]
42use std::mem::size_of;
43#[cfg(any(target_os = "macos", target_os = "ios"))]
44use std::mem::size_of_val;
45#[cfg(any(target_os = "linux", target_os = "android"))]
46use std::path::Path;
47#[cfg(target_os = "android")]
48use std::ptr::copy_nonoverlapping;
49#[cfg(any(target_os = "macos", target_os = "ios", target_os = "linux", windows))]
50use std::ptr::null;
51use std::{
52    any::{Any, TypeId},
53    cell::{Cell, Ref, RefCell, RefMut},
54    collections::{HashMap, HashSet},
55    error::Error,
56    f32::consts::{FRAC_PI_2, PI, SQRT_2, TAU},
57    fmt::{self, Formatter},
58    hash::{Hash, Hasher},
59    marker::PhantomData,
60    mem::{swap, take, transmute},
61    ops::{Add, Mul, Sub},
62    ptr::null_mut,
63    rc::Rc,
64    slice::from_raw_parts_mut,
65    str::{Chars, from_utf8},
66    sync::atomic::{AtomicPtr, AtomicUsize, Ordering},
67};
68#[cfg(not(target_arch = "wasm32"))]
69use std::{
70    fs,
71    io::{self, Read, Write},
72    net::{SocketAddr, TcpStream, ToSocketAddrs},
73    slice::from_raw_parts,
74    sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock, PoisonError},
75    thread::{Builder, JoinHandle, available_parallelism, sleep},
76    time::{Duration, Instant},
77};
78#[cfg(all(test, not(target_arch = "wasm32")))]
79use std::{net::TcpListener, thread::spawn};
80
81use {
82    lombok_macros::{CustomDebug, Data, Getter, New},
83    serde::{Deserialize, Serialize},
84    serde_json::{Value, from_str, to_string, to_string_pretty},
85};
86
87#[cfg(target_arch = "wasm32")]
88use {
89    js_sys::Object,
90    wasm_bindgen::{Clamped, JsCast, JsValue},
91    web_sys::{
92        CanvasRenderingContext2d, Document, DomRect, Element, HtmlCanvasElement, ImageData,
93        MediaQueryList, TextMetrics, WebGl2RenderingContext, WebGlProgram, WebGlShader, Window,
94        window,
95    },
96};