1#![cfg_attr(not(feature = "std"), no_std)]
3#![feature(assert_matches)]
4#![feature(gen_blocks)]
5#![feature(async_iterator)]
6#![feature(type_alias_impl_trait)]
7#![feature(trait_alias)]
8#![feature(box_patterns)]
9#![feature(if_let_guard)]
10#![feature(try_trait_v2)]
11#![feature(associated_type_defaults)]
13#![feature(core_float_math)]
14#![feature(thread_local)]
15#![feature(future_join)]
16#![allow(static_mut_refs)]
17#![feature(variant_count)]
18#![feature(const_cmp)]
19#![feature(const_trait_impl)]
20#![feature(custom_test_frameworks)]
21#![feature(specialization)]
22#![feature(const_default)]
23extern crate alloc;
24extern crate num_integer;
25
26#[cfg(feature = "std")]
27extern crate std;
28
29pub mod channel;
30pub mod prelude;
31
32#[cfg(feature = "ast")]
33pub mod ast;
34#[cfg(feature = "compiler")]
35pub mod compiler;
36#[cfg(feature = "decompiler")]
37pub mod decompiler;
38#[cfg(feature = "compiler")]
39pub mod fmt;
40pub mod global;
41pub mod libs;
42#[cfg(all(feature = "lsp", feature = "std"))]
43pub mod lsp;
44pub mod network;
45#[cfg(feature = "parser")]
46pub mod parser;
47pub mod runtime;
48pub mod shared_values;
49#[cfg(feature = "compiler")]
50pub mod type_inference;
51#[cfg(feature = "compiler")]
52pub mod visitor;
53
54pub mod core_compiler;
55pub mod datex_proxy;
56pub mod dif;
57pub mod disassembler;
58pub mod dxb_parser;
59mod stub;
60pub mod task;
61pub mod traits;
62pub mod types;
63pub mod utils;
64pub mod value_updates;
65pub mod values;
66
67pub use datex_macros_internal as macros;
69extern crate core;
70
71pub mod datex_registry;
72pub use inventory;
73
74pub mod collections {
76 #[cfg(feature = "std")]
77 pub use std::collections::{HashMap, HashSet, hash_map, hash_set};
78
79 #[cfg(not(feature = "std"))]
80 pub use hashbrown::{HashMap, HashSet, hash_map, hash_set};
81}
82
83pub mod std_sync {
85 #[cfg(not(feature = "std"))]
86 pub use spin::Mutex;
87 #[cfg(feature = "std")]
88 pub use std::sync::Mutex;
89}
90
91pub mod crypto {
93 cfg_if::cfg_if! {
94 if #[cfg(any(feature = "target_native", test))] {
95 pub use datex_crypto_native::CryptoNative as CryptoImpl;
96 } else if #[cfg(feature = "target_esp_shared")] {
97 pub use datex_crypto_esp32::CryptoEsp32 as CryptoImpl;
98 } else if #[cfg(feature = "target_wasm")] {
99 pub use datex_crypto_web::CryptoWeb as CryptoImpl;
100 } else {
101 pub use crate::stub::crypto::CryptoStub as CryptoImpl;
102 }
103 }
104}
105
106pub mod time {
107
108 mod system_time {
109 cfg_if::cfg_if! {
110 if #[cfg(feature = "target_wasm")] {
111 pub use web_time::{SystemTime, UNIX_EPOCH};
112 } else if #[cfg(feature = "target_native")] {
113 pub use std::time::{SystemTime, UNIX_EPOCH};
114 }
115 }
116 }
117
118 cfg_if::cfg_if! {
119 if #[cfg(feature = "target_wasm")] {
120 pub use web_time::{Instant};
121 } else if #[cfg(feature = "std")] {
122 pub use std::time::{Instant};
123 } else if #[cfg(feature = "embassy_runtime")] {
124 pub use embassy_time::{Instant};
125 } else {
126 pub use crate::stub::time::{Instant};
127 }
128 }
129
130 pub fn now_ms() -> u64 {
132 cfg_if::cfg_if! {
133 if #[cfg(any(feature = "target_wasm", feature = "target_native"))] {
134 use system_time::{SystemTime, UNIX_EPOCH};
135 SystemTime::now()
136 .duration_since(UNIX_EPOCH)
137 .expect("System time is before UNIX_EPOCH")
138 .as_millis() as u64
139 } else if #[cfg(feature = "target_esp_shared")] {
140 datex_crypto_esp32::now_ms()
141 } else {
142 Instant::now().elapsed().as_millis() as u64
143 }
144 }
145 }
146}
147
148pub mod random {
149 #[cfg(not(feature = "std"))]
150 pub use foldhash::fast::RandomState;
151 #[cfg(feature = "std")]
152 pub use std::hash::RandomState;
153}