rquickjs_core/
runtime.rs

1//! QuickJS runtime related types.
2
3mod 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
15pub use base::{Runtime, WeakRuntime};
16pub use userdata::{UserDataError, UserDataGuard};
17
18#[cfg(feature = "futures")]
19pub(crate) use r#async::InnerRuntime;
20#[cfg(feature = "futures")]
21pub use r#async::{AsyncRuntime, AsyncWeakRuntime};
22
23use crate::{Ctx, Value};
24
25/// The type of the promise rejection tracker.
26#[cfg(not(feature = "parallel"))]
27pub type RejectionTracker = Box<dyn for<'a> Fn(Ctx<'a>, Value<'a>, Value<'a>, bool) + 'static>;
28/// The type of the promise rejection tracker.
29#[cfg(feature = "parallel")]
30pub type RejectionTracker =
31    Box<dyn for<'a> Fn(Ctx<'a>, Value<'a>, Value<'a>, bool) + Send + 'static>;
32
33/// The type of the interrupt handler.
34#[cfg(not(feature = "parallel"))]
35pub type InterruptHandler = Box<dyn FnMut() -> bool + 'static>;
36/// The type of the interrupt handler.
37#[cfg(feature = "parallel")]
38pub type InterruptHandler = Box<dyn FnMut() -> bool + Send + 'static>;
39
40/// A struct with information about the runtimes memory usage.
41pub type MemoryUsage = crate::qjs::JSMemoryUsage;