difftreelog
refactor drop wasm interop from bindings
in: master
Not needed with the introducion of jrsonnet-web
2 files changed
bindings/jsonnet/Cargo.tomldiffbeforeafterboth1# NOTE: This library may panic, and it is only safe to panic in FFI contexts when library is built in panic="abort" mode,2# which is set for release builds of this library.3# FIXME: Move this warning somewhere else, or remove panics from this library (It is not always possible, in some cases4# there is nothing to report the error, in those cases use `abort()`)5# NOTE: This library assumes the allocator is libc malloc or alternative, which does track allocation size for user,6# see TODO in `jsonnet_realloc`.78[package]9name = "libjsonnet"10description = "Rust implementation of libjsonnet.so"11authors.workspace = true12edition.workspace = true13license.workspace = true14repository.workspace = true15version.workspace = true16publish = false1718[lints]19workspace = true2021[dependencies]22jrsonnet-evaluator.workspace = true23jrsonnet-ir.workspace = true24jrsonnet-stdlib.workspace = true25jrsonnet-gcmodule.workspace = true26jrsonnet-interner.workspace = true2728[lib]29name = "jsonnet"30crate-type = ["cdylib", "staticlib"]3132[features]33default = ["interop-common", "interop-wasm", "interop-threading"]34# Export additional functions for native integration, i.e ability to set custom trace format35interop-common = []36# Provide ability to statically override callbacks from WASM (by using imports)37interop-wasm = []38# Provide ability to move jsonnet vm state between threads39interop-threading = []4041experimental = ["exp-preserve-order", "exp-destruct"]42exp-preserve-order = [43 "jrsonnet-evaluator/exp-preserve-order",44 "jrsonnet-stdlib/exp-preserve-order",45]46exp-destruct = ["jrsonnet-evaluator/exp-destruct"]bindings/jsonnet/src/interop.rsdiffbeforeafterboth--- a/bindings/jsonnet/src/interop.rs
+++ b/bindings/jsonnet/src/interop.rs
@@ -1,62 +1,5 @@
//! Jrsonnet specific additional binding helpers
-#[cfg(feature = "interop-wasm")]
-pub mod wasm {
- use std::ffi::{c_char, c_int, c_void};
-
- use jrsonnet_evaluator::Val;
-
- use crate::VM;
-
- unsafe extern "C" {
- pub fn _jrsonnet_static_import_callback(
- ctx: *mut c_void,
- base: *const c_char,
- rel: *const c_char,
- found_here: *mut *const c_char,
- buf: *mut *mut c_char,
- buflen: *mut usize,
- ) -> c_int;
-
- #[allow(improper_ctypes)]
- pub fn _jrsonnet_static_native_callback(
- ctx: *const c_void,
- argv: *const *const Val,
- success: *mut c_int,
- ) -> *mut Val;
- }
-
- #[unsafe(no_mangle)]
- #[cfg(feature = "interop-wasm")]
- // ctx arg is passed as-is to callback
- #[allow(clippy::not_unsafe_ptr_arg_deref)]
- pub extern "C" fn jrsonnet_apply_static_import_callback(vm: &VM, ctx: *mut c_void) {
- unsafe { crate::import::jsonnet_import_callback(vm, _jrsonnet_static_import_callback, ctx) }
- }
-
- /// # Safety
- ///
- /// `name` and `raw_params` should be correctly initialized
- #[unsafe(no_mangle)]
- #[cfg(feature = "interop-wasm")]
- pub unsafe extern "C" fn jrsonnet_apply_static_native_callback(
- vm: &VM,
- name: *const c_char,
- ctx: *mut c_void,
- raw_params: *const *const c_char,
- ) {
- unsafe {
- crate::native::jsonnet_native_callback(
- vm,
- name,
- _jrsonnet_static_native_callback,
- ctx,
- raw_params,
- );
- }
- }
-}
-
#[cfg(feature = "interop-common")]
mod common {
use jrsonnet_evaluator::trace::{CompactFormat, HiDocFormat, JsFormat, PathResolver};