1mod base;
4pub(crate) mod opaque;
5pub(crate) mod raw;
6mod userdata;
7
8#[cfg(feature = "futures")]
9mod r#async;
10#[cfg(feature = "futures")]
11pub(crate) mod schedular;
12#[cfg(feature = "futures")]
13mod spawner;
14#[cfg(feature = "futures")]
15pub use spawner::DriveFuture;
16
17use alloc::boxed::Box;
18pub use base::{Runtime, WeakRuntime};
19pub use userdata::{UserDataError, UserDataGuard};
20
21#[cfg(feature = "futures")]
22pub(crate) use r#async::InnerRuntime;
23#[cfg(feature = "futures")]
24pub use r#async::{AsyncRuntime, AsyncWeakRuntime};
25
26use crate::value::promise::PromiseHookType;
27use crate::{Ctx, Value};
28
29#[cfg(not(feature = "parallel"))]
31pub type PromiseHook =
32 Box<dyn for<'a> Fn(Ctx<'a>, PromiseHookType, Value<'a>, Value<'a>) + 'static>;
33#[cfg(feature = "parallel")]
35pub type PromiseHook =
36 Box<dyn for<'a> Fn(Ctx<'a>, PromiseHookType, Value<'a>, Value<'a>) + Send + 'static>;
37
38#[cfg(not(feature = "parallel"))]
40pub type RejectionTracker = Box<dyn for<'a> Fn(Ctx<'a>, Value<'a>, Value<'a>, bool) + 'static>;
41#[cfg(feature = "parallel")]
43pub type RejectionTracker =
44 Box<dyn for<'a> Fn(Ctx<'a>, Value<'a>, Value<'a>, bool) + Send + 'static>;
45
46#[cfg(not(feature = "parallel"))]
48pub type InterruptHandler = Box<dyn FnMut() -> bool + 'static>;
49#[cfg(feature = "parallel")]
51pub type InterruptHandler = Box<dyn FnMut() -> bool + Send + 'static>;
52
53pub type MemoryUsage = crate::qjs::JSMemoryUsage;