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