1pub mod application;
7#[macro_use]
8pub mod messenger;
9#[macro_use]
10pub mod props;
11pub mod renderer;
12pub mod state;
13#[macro_use]
14pub mod widget;
15pub mod animator;
16pub mod interactive;
17pub mod layout;
18pub mod signals;
19pub mod tester;
20pub mod view_model;
21
22pub type Scalar = f32;
23pub type Integer = i32;
24pub type UnsignedInteger = u32;
25
26pub use intuicio_data::{lifetime::*, managed::*, type_hash::*};
27pub use raui_derive::*;
28use serde::{Serialize, de::DeserializeOwned};
29#[doc(inline)]
30pub use serde_json::{Number as PrefabNumber, Value as PrefabValue};
31
32#[derive(Debug, Clone)]
34pub enum PrefabError {
35 CouldNotSerialize(String),
36 CouldNotDeserialize(String),
37}
38
39pub trait Prefab: Serialize + DeserializeOwned {
45 fn from_prefab(data: PrefabValue) -> Result<Self, PrefabError> {
46 match serde_json::from_value(data) {
47 Ok(result) => Ok(result),
48 Err(error) => Err(PrefabError::CouldNotDeserialize(error.to_string())),
49 }
50 }
51
52 fn to_prefab(&self) -> Result<PrefabValue, PrefabError> {
53 match serde_json::to_value(self) {
54 Ok(result) => Ok(result),
55 Err(error) => Err(PrefabError::CouldNotSerialize(error.to_string())),
56 }
57 }
58}
59
60#[derive(Debug, Copy, Clone, PartialEq, Eq)]
61pub enum LogKind {
62 Info,
63 Warning,
64 Error,
65}
66
67pub trait Logger {
72 fn log(&mut self, _kind: LogKind, _message: &str) {}
78}
79
80impl Logger for () {}
81
82pub struct PrintLogger;
84
85impl Logger for PrintLogger {
86 fn log(&mut self, kind: LogKind, message: &str) {
87 println!("{kind:?} | {message}");
88 }
89}