You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I see that there is no support for shared buffer which is important for wasmtime integration in Den, because the user can mutate the underlying WebAssembly memory object inside Javascript, but right now all the API in rquickjs requires creating copied value from Rust, rather than from a slice. I tried to sidestep it by doing this:
#[qjs(get, enumerable)]pubfnbuffer<'js>(&self,ctx:Ctx<'js>) -> Result<ArrayBuffer<'js>>{let data = self.inner.data(self.store.lock().unwrap().as_context());let val = unsafe{let val = qjs::JS_NewArrayBuffer(
ctx.as_raw().as_mut(),
data.as_mut_ptr(),
data.len().try_into().unwrap(),None,// No need for deallocation
ptr::null_mut(),// No opaque1,// True = Shared);if qjs::JS_VALUE_GET_NORM_TAG(val) == qjs::JS_TAG_EXCEPTION{returnErr(rquickjs::Error::Exception);}Value::from_js_value(ctx.clone(), val)};let buffer = ArrayBuffer::from_object(Object::from_value(val)?).unwrap();Ok(buffer)}
But function from_js_value is private and there seems to be no way to create that Rust-based value wrapper as well.
The text was updated successfully, but these errors were encountered:
I see that there is no support for shared buffer which is important for wasmtime integration in Den, because the user can mutate the underlying WebAssembly memory object inside Javascript, but right now all the API in rquickjs requires creating copied value from Rust, rather than from a slice. I tried to sidestep it by doing this:
But function
from_js_value
is private and there seems to be no way to create that Rust-based value wrapper as well.The text was updated successfully, but these errors were encountered: