git.delta.rocks / jrsonnet / refs/commits / 63230e6bbdf4

difftreelog

refactor drop wasm interop from bindings

qstsyplpYaroslav Bolyukin2026-05-05parent: #387e99d.patch.diff
in: master
Not needed with the introducion of jrsonnet-web

2 files changed

modifiedbindings/jsonnet/Cargo.tomldiffbeforeafterboth
30crate-type = ["cdylib", "staticlib"]30crate-type = ["cdylib", "staticlib"]
3131
32[features]32[features]
33default = ["interop-common", "interop-wasm", "interop-threading"]33default = ["interop-common", "interop-threading"]
34# Export additional functions for native integration, i.e ability to set custom trace format34# Export additional functions for native integration, i.e ability to set custom trace format
35interop-common = []35interop-common = []
36# Provide ability to statically override callbacks from WASM (by using imports)
37interop-wasm = []
38# Provide ability to move jsonnet vm state between threads36# Provide ability to move jsonnet vm state between threads
39interop-threading = []37interop-threading = []
4038
modifiedbindings/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};