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