Skip to main content

All Questions

Filter by
Sorted by
Tagged with
1 vote
0 answers
20 views

How do I import WASM in Worker JS in a Vue 3 project powered by Vite?

I am trying to request a WASM function within a JS Worker. I am stuck with it because nothing works in the way I have tried, but also I cannot see any error. Let me explain what I am doing. First, I ...
Fomalhaut's user avatar
  • 9,893
2 votes
1 answer
60 views

Rust WASM memory ptr is not same as JS Arraybuffer offset

I try to pass json content from js to rust with zero copy, but is seems the memory where rust vec ptr point to is not same as js arraybuffer with offset. My Env: cargo 1.83.0 wasm-pack 0.13.1 wasm-...
NightmareRevisited's user avatar
2 votes
0 answers
80 views

What is the cleanest way to re-implement Rust's BufRead, Read, and Seek traits for WASM?

I am working on a VScode extension, which uses a combination of Typescript and WebAssembly for file parsing and data handling. The parser is written in rust and compiled to WASM, as this is faster and ...
user28169578's user avatar
2 votes
1 answer
156 views

Rust WASM code stalls on awaiting web_sys::Window.fetch_with_request

I am trying to use the Fetch API using web_sys in Rust WASM code. I have defined an async function: #[wasm_bindgen] pub async fn fetch_as_vec_u8(resource_name: &str) -> Result<Vec<u8>, ...
Vasili Korol's user avatar
0 votes
1 answer
95 views

How can I return a tuple to javascript from wasm where elements have non Copy/Clone traits?

I have a problem where I need to return a tuple from a wasm function as the following: #[wasm_bindgen] pub fn channel() -> (futures::channel::mpsc::Sender<i32>, futures::channel::mpsc::...
Kevin's user avatar
  • 3,378
3 votes
1 answer
83 views

How to use string slices in Rust targeting WebAssembly

I've developped a library in Rust to parse RTF content. I've initially targeted x86 architectures. So I have use lots of string slices (&str) to reference to the original source without copying ...
Dorian B's user avatar
  • 170
0 votes
0 answers
52 views

How to use a WASM binary in an NPM package using Rollup

Github Repository to reproduce issue: https://github.com/kyledecot/rollup I have three packages: C -> B -> A Package C is a react component library that wraps package B. Package B contains a ...
Kyle Decot's user avatar
  • 20.9k
1 vote
1 answer
178 views

Compile C++ Shared Object library to Web assembly

I have C++ data.so shared object library that was compiled for linux_x86 architecture. I would like to write my application in C++, link to the shared object library but build both of them together ...
Bazbaz's user avatar
  • 61
0 votes
1 answer
143 views

Does WASM Bindgen copy &mut [u8] zero times or twice?

From JavaScript, I call this Rust function. Does Bindgen copy the memory twice or zero times? #[wasm_bindgen] pub fn mod_u8_slice(input_output: &mut [u8]) { input_output.iter_mut().for_each(|x|...
Carl's user avatar
  • 383
2 votes
0 answers
95 views

After 'cargo install wasm-pack' do I need to manually update chrome & chromedriver?

I'm on Windows 11. When I cargo install wasm-pack it installs chromedriver v 114, but v 114 doesn't work with the current version of Chrome. I want to be able to run tests via wasm-pack test --chrome -...
Carl's user avatar
  • 383
3 votes
1 answer
1k views

How you can link a Rust library with C/C++ and wasm-bindgen for the wasm32-unknown-unknown target?

Title. What are the specific steps to compile and link C/C++ and Rust under the same WASM binary for wasm32-unknown-unknown while using wasm-bindgen? Context wasm32-unknown-emscripten is a legacy ...
Rafael Beckel's user avatar
1 vote
1 answer
149 views

Compiling rust with webback for webassembly

The error occurs when i use opencascade = "0.2.0" dependency. following is my Cargo.toml [package] name = "wasm-demo" version = "0.1.0" authors = ["Ravi"] ...
Ravi Belkhindi's user avatar
0 votes
0 answers
141 views

How can I make a simple requestAnimationFrame loop in Rust with arguments?

I am trying to make a requestAnimationFrame loop in Rust with arguments. I've looked and found how to make a requestAnimationFrame loop like so: fn loop() { // do stuff here let closure = ...
CodingMaster239's user avatar
0 votes
1 answer
194 views

Read an array of bools from wasm memory

I'm trying to read an array of boolean values directly from wasm memory, but I can't figure out how I can read the array from JavaScript. The code that I'm trying to bind to JavaScript is similar to ...
B. Sebastiano's user avatar
0 votes
0 answers
60 views

How can I consume a (rust) `.wasm` lib in wasmedge_quickjs?

I'd like to make an isomorphic wasm library that can be consumed both in the browser and wasmedge-quickjs. To do this, I have a simple demo lib: use wasm_bindgen::prelude::*; #[wasm_bindgen] pub fn ...
Devildude4427's user avatar

15 30 50 per page
1
2 3 4 5
11