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(any(
32    target_os = "macos",
33    target_os = "ios",
34    target_os = "linux",
35    target_os = "android"
36))]
37use std::ffi::CStr;
38#[cfg(unix)]
39use std::ffi::CString;
40#[cfg(unix)]
41use std::ffi::c_char;
42#[cfg(any(unix, windows))]
43use std::ffi::c_void;
44#[cfg(any(target_os = "macos", target_os = "ios"))]
45use std::mem::size_of_val;
46#[cfg(unix)]
47use std::mem::zeroed;
48#[cfg(target_os = "android")]
49use std::ptr::copy_nonoverlapping;
50#[cfg(any(target_os = "macos", target_os = "ios", target_os = "linux", windows))]
51use std::ptr::null;
52#[cfg(target_arch = "wasm32")]
53use std::sync::{Arc, Mutex, MutexGuard};
54#[cfg(not(target_arch = "wasm32"))]
55use std::{
56    any::Any,
57    env, fs,
58    hint::spin_loop,
59    io::{self, BufRead, BufReader, ErrorKind, IsTerminal, Read, Write, stderr, stdout},
60    net::{SocketAddr, TcpStream, ToSocketAddrs},
61    slice::from_raw_parts,
62    str::Lines,
63    sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock, PoisonError},
64    thread::{Builder, JoinHandle, available_parallelism, current, sleep},
65    time::{Duration, Instant},
66};
67use std::{
68    any::TypeId,
69    borrow::Cow,
70    cell::{Cell, Ref, RefCell, RefMut},
71    collections::{BTreeMap, BTreeSet, HashMap, HashSet, VecDeque},
72    error::Error,
73    f32::consts::{FRAC_PI_2, PI, SQRT_2, TAU},
74    fmt::{self, Formatter},
75    hash::{Hash, Hasher},
76    marker::PhantomData,
77    mem::{MaybeUninit, align_of, size_of, swap, take, transmute},
78    ops::{Add, Mul, Sub},
79    ptr::{drop_in_place, null_mut},
80    rc::Rc,
81    slice::from_raw_parts_mut,
82    str::{Chars, from_utf8},
83    sync::atomic::{AtomicBool, AtomicPtr, AtomicU64, AtomicUsize, Ordering},
84    thread::panicking,
85};
86#[cfg(all(test, not(target_arch = "wasm32")))]
87use std::{net::TcpListener, thread::spawn};
88
89use {
90    lombok_macros::{CustomDebug, Data, Getter, New},
91    serde::{Deserialize, Serialize},
92    serde_json::{Value, from_str, to_string, to_string_pretty},
93};
94
95#[cfg(target_arch = "wasm32")]
96use {
97    js_sys::{Function, Object, Promise, Reflect},
98    wasm_bindgen::{Clamped, JsCast, JsValue, closure::Closure},
99    web_sys::{
100        CanvasRenderingContext2d, Clipboard, Document, DomRect, Element, Event, HtmlCanvasElement,
101        ImageData, MediaQueryList, Navigator, Performance, TextMetrics, WebGl2RenderingContext,
102        WebGlProgram, WebGlShader, Window, window,
103    },
104};