Skip to main content

rquickjs_sys/
lib.rs

1#![allow(non_upper_case_globals)]
2#![allow(non_camel_case_types)]
3#![allow(non_snake_case)]
4#![allow(clippy::unreadable_literal)]
5#![allow(clippy::missing_safety_doc)]
6#![allow(clippy::upper_case_acronyms)]
7#![allow(clippy::uninlined_format_args)]
8#![no_std]
9
10use ::core::ptr;
11
12/// Common error message for converting between C `size_t` and Rust `usize`;
13pub const SIZE_T_ERROR: &str =
14    "conversion between C type 'size_t' and Rust type 'usize' overflowed.";
15
16include!(concat!(env!("OUT_DIR"), "/bindings.rs"));
17
18/// Build-time metadata generated from QuickJS's `quickjs-opcode.h` macros.
19#[cfg(feature = "jit-abi")]
20#[derive(Clone, Copy, Debug, Eq, PartialEq)]
21pub struct JitGeneratedOpcode {
22    pub opcode: u8,
23    pub size: u8,
24    pub n_pop: u8,
25    pub n_push: u8,
26    pub format: u8,
27    pub format_name: &'static str,
28    pub name: &'static str,
29}
30
31#[cfg(feature = "jit-abi")]
32include!(concat!(env!("OUT_DIR"), "/quickjs-jit-opcodes.rs"));
33
34/// Build-time metadata generated from the canonical helper X-macro table.
35#[cfg(feature = "jit-abi")]
36#[derive(Clone, Copy, Debug, Eq, PartialEq)]
37pub struct JitGeneratedHelper {
38    pub id: u16,
39    pub name: &'static str,
40    pub abi_types: &'static [u8],
41    pub value_arity: u8,
42    pub value_ownership: &'static [u8],
43    pub output_ownership: u8,
44    pub flags: u32,
45}
46
47#[cfg(feature = "jit-abi")]
48include!(concat!(env!("OUT_DIR"), "/quickjs-jit-helpers.rs"));
49
50#[doc(hidden)]
51#[cfg(all(feature = "jit-test-support", feature = "bindgen"))]
52pub const JIT_BINDGEN_BINDINGS: Option<&str> =
53    Some(include_str!(concat!(env!("OUT_DIR"), "/bindings.rs")));
54
55#[doc(hidden)]
56#[cfg(all(feature = "jit-test-support", not(feature = "bindgen")))]
57pub const JIT_BINDGEN_BINDINGS: Option<&str> = None;
58
59#[cfg(not(feature = "bindgen"))]
60include!(concat!("bindings/", bindings_env!("TARGET"), ".rs"));
61
62#[cfg(target_pointer_width = "64")]
63include!("inlines/ptr_64.rs");
64
65#[cfg(target_pointer_width = "32")]
66include!("inlines/ptr_32_nan_boxing.rs");
67
68include!("inlines/common.rs");