1mod build;
2mod children;
3mod context;
4mod event;
5mod layout;
6mod node;
7mod reactive;
8mod style;
9mod unit;
10mod view;
11mod views;
12
13pub use build::*;
14pub use children::*;
15pub use context::*;
16pub use event::*;
17pub use layout::*;
18pub use node::*;
19pub use reactive::*;
20pub use style::*;
21pub use unit::*;
22pub use view::*;
23pub use views::*;
24
25pub use glam::*;
26
27pub use tracing::{debug, error, info, trace, warn};
28
29#[cfg(feature = "multithread")]
30pub(crate) type Shared<T> = std::sync::Arc<T>;
31#[cfg(feature = "multithread")]
32pub(crate) type Weak<T> = std::sync::Weak<T>;
33#[cfg(feature = "multithread")]
34pub(crate) type Lock<T> = std::sync::Mutex<T>;
35#[cfg(feature = "multithread")]
36pub(crate) type Guard<'a, T> = std::sync::MutexGuard<'a, T>;
37
38#[cfg(not(feature = "multithread"))]
39pub(crate) type Shared<T> = std::rc::Rc<T>;
40#[cfg(not(feature = "multithread"))]
41pub(crate) type Weak<T> = std::rc::Weak<T>;
42#[cfg(not(feature = "multithread"))]
43pub(crate) type Lock<T> = std::cell::RefCell<T>;
44#[cfg(not(feature = "multithread"))]
45pub(crate) type Guard<'a, T> = std::cell::RefMut<'a, T>;
46
47#[cfg(feature = "multithread")]
51pub trait Sendable: Send {}
52#[cfg(feature = "multithread")]
53impl<T: Send> Sendable for T {}
54
55#[cfg(not(feature = "multithread"))]
59pub trait Sendable {}
60#[cfg(not(feature = "multithread"))]
61impl<T> Sendable for T {}
62
63#[cfg(feature = "multithread")]
67pub trait SendSync: Send + Sync {}
68#[cfg(feature = "multithread")]
69impl<T: Send + Sync> SendSync for T {}
70
71#[cfg(not(feature = "multithread"))]
75pub trait SendSync {}
76#[cfg(not(feature = "multithread"))]
77impl<T> SendSync for T {}
78
79pub(crate) trait Lockable {
80 type Item: ?Sized;
81
82 fn lock_mut(&self) -> Guard<'_, Self::Item>;
83}
84
85impl<T: ?Sized> Lockable for Lock<T> {
86 type Item = T;
87
88 #[cfg(feature = "multithread")]
89 fn lock_mut(&self) -> Guard<'_, Self::Item> {
90 self.lock().unwrap()
91 }
92
93 #[cfg(not(feature = "multithread"))]
94 fn lock_mut(&self) -> Guard<'_, Self::Item> {
95 self.borrow_mut()
96 }
97}