Skip to main content

code_native/vendor/
borrowed_abi.rs

1//! Optional metadata-dispatch wire types; mirrored in code-native/vendor.
2use core::ffi::c_void;
3
4#[repr(C)]
5pub struct CodeValueInfo {
6    /// The existing CodeTag integer. Scalars other than strings expose only tag.
7    pub tag: i32,
8    /// Array/object element count or UTF-8 byte count; zero for other scalars.
9    pub length: u64,
10    /// Borrowed UTF-8 bytes for strings, null otherwise (also allowed if empty).
11    pub bytes: *const u8,
12}
13
14#[repr(C)]
15pub struct CodeBorrowedApi {
16    pub version: u32,
17    pub inspect: unsafe extern "C" fn(*const c_void) -> CodeValueInfo,
18    /// First matching field; null for missing/non-object. Key is UTF-8, not CStr.
19    pub field: unsafe extern "C" fn(*const c_void, *const u8, u64) -> *const c_void,
20}