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    io::{self, Read, Write},
73    net::{SocketAddr, TcpStream, ToSocketAddrs},
74    slice::from_raw_parts,
75    sync::{Arc, Condvar, Mutex, MutexGuard, OnceLock, PoisonError},
76    thread::{Builder, JoinHandle, available_parallelism, sleep},
77    time::{Duration, Instant},
78};
79#[cfg(all(test, not(target_arch = "wasm32")))]
80use std::{net::TcpListener, thread::spawn};
81
82use {
83    lombok_macros::{CustomDebug, Data, Getter, New},
84    serde::{Deserialize, Serialize},
85    serde_json::{Value, from_str, to_string, to_string_pretty},
86};
87
88#[cfg(target_arch = "wasm32")]
89use {
90    js_sys::Object,
91    wasm_bindgen::{Clamped, JsCast, JsValue},
92    web_sys::{
93        CanvasRenderingContext2d, Document, DomRect, Element, HtmlCanvasElement, ImageData,
94        MediaQueryList, TextMetrics, WebGl2RenderingContext, WebGlProgram, WebGlShader, Window,
95        window,
96    },
97};