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    borrow::Cow,
54    cell::{Cell, Ref, RefCell, RefMut},
55    collections::{HashMap, HashSet},
56    error::Error,
57    f32::consts::{FRAC_PI_2, PI, SQRT_2, TAU},
58    fmt::{self, Formatter},
59    hash::{Hash, Hasher},
60    marker::PhantomData,
61    mem::{swap, take, transmute},
62    ops::{Add, Mul, Sub},
63    ptr::null_mut,
64    rc::Rc,
65    slice::from_raw_parts_mut,
66    str::{Chars, from_utf8},
67    sync::atomic::{AtomicPtr, AtomicUsize, Ordering},
68};
69#[cfg(not(target_arch = "wasm32"))]
70use std::{
71    fs,
72    hint::spin_loop,
73    io::{self, Read, Write},
74    net::{SocketAddr, TcpStream, ToSocketAddrs},
75    slice::from_raw_parts,
76    sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock, PoisonError},
77    thread::{Builder, JoinHandle, available_parallelism, sleep},
78    time::{Duration, Instant},
79};
80#[cfg(all(test, not(target_arch = "wasm32")))]
81use std::{net::TcpListener, thread::spawn};
82
83use {
84    lombok_macros::{CustomDebug, Data, Getter, New},
85    serde::{Deserialize, Serialize},
86    serde_json::{Value, from_str, to_string, to_string_pretty},
87};
88
89#[cfg(target_arch = "wasm32")]
90use {
91    js_sys::Object,
92    wasm_bindgen::{Clamped, JsCast, JsValue},
93    web_sys::{
94        CanvasRenderingContext2d, Document, DomRect, Element, HtmlCanvasElement, ImageData,
95        MediaQueryList, TextMetrics, WebGl2RenderingContext, WebGlProgram, WebGlShader, Window,
96        window,
97    },
98};