Questions tagged [wasm-bindgen]

wasm-bindgen is a rust crate for facilitating high-level interactions between WebAssembly (Wasm) modules and JavaScript.

254 questions
0
votes
2 answers

return a rust-wasm vector in angular application

I have a basic angular app and a Rust wasm pack, and I want to call functions in the Rust compiled code in angular. The rust code template is taken from the rust-pack-template-repo in lib.rs is the following: mod utils; use…
alpha027
  • 302
  • 2
  • 13
0
votes
1 answer

Error running a Bevy game in browser: "WebAssembly.instantiate(): Import #0 module="wbindgen_placeholder" error: module is not an object or function"

I am trying to run a game I built with Bevy and Rust in the browser. Bevy started supporting WebGL2 from version 0.11.0, and I am using this version. I have compiled my Rust code to WebAssembly using wasm-pack build --target web. However, when I try…
jjreedv
  • 71
  • 2
  • 7
0
votes
0 answers

tonic_web_wasm_client not sending content-type header for gRPC web requests

I have a gRPC GO server that I am trying to connect to using a Rust WASM client. The proto file looks like this: syntax = "proto3"; package pb; message SubscribeRequest { string id = 1; } message Response { string transcript = 1; } service…
Mavese
  • 131
  • 10
0
votes
1 answer

Dioxus app failed to load - This is probably due to the Bindgen version, dioxus-cli using `0.2.81` Bindgen crate

I've decided to give Dioxus another shot. This time, I tried launching a recently created Dioxus app, and got the following error: [WARN] Config file: `Dioxus.toml` not found; using default config. [WARN] Config file: `Dioxus.toml` not found; using…
Jose A
  • 10,053
  • 11
  • 75
  • 108
0
votes
0 answers

Rust WASM memory.buffer TypeError: Cannot read properties of undefined (reading 'buffer')

I'm learning wasm knowledge recently, and I want to use memory.buffer-related knowledge, but I can't run the content of this chapter smoothly: https://rustwasm.github.io/wasm-bindgen/reference/types/pointers.html Can anyone kindly help me get it up…
Jay
  • 23
  • 3
0
votes
0 answers

read-fonts Rust wasm: Uncaught (in promise) RuntimeError: unreachable

I want to rust read-fonts within a browser using wasm. Please see the following github repository with the code: https://github.com/moontypespace/hello_wasm/tree/main I get the following error: hello_wasm_bg.wasm:0x5117 Uncaught (in promise)…
0
votes
1 answer

rust wasm-pack build warning: private type `World` in public interface (error E0446)

i have this code and i dont understand why is this warrning is poping: use wasm_bindgen::prelude::*; #[global_allocator] static ALLOC: wee_alloc::WeeAlloc = wee_alloc::WeeAlloc::INIT; #[wasm_bindgen] struct World { width:…
user63898
  • 29,839
  • 85
  • 272
  • 514
0
votes
1 answer

WebGPU Rust and Javascript communication

I incorporate WebGPU+Rust in the following way (index.html)
alagris
  • 1,838
  • 16
  • 31
0
votes
0 answers

Compiling rust iced example to wasm - image assets path

I want to compile one of the iced example to wasm, but it doesn't find image(ferris.png). Here's my code. It has also package.json file with scripts to build and run page on localhost:3000(yarn build and yarn dev should be enough, but you can also…
Wiktor Kujawa
  • 595
  • 4
  • 21
0
votes
2 answers

Using a function from a wasm module in JavaScript

I've decided to learn Rust alongside Web Assembly to get into more cloud computing. I'm trying to make a Rust app that connects to a Redis cache and increments a value each time a function is called. I then want to export that function with the…
Reuben
  • 39
  • 9
0
votes
0 answers

How to use a Wasm class compiled using EMScripten in Angular

I sucessfully generate a wasm module using emscripten. A .js file is generated along a .wasm file. Loading through node.js works like a charm. So far so good. C++ bindings looks like this: #include "worker.hpp" #include using…
Victor
  • 486
  • 3
  • 8
0
votes
1 answer

Why is my member variable not getting updated

here is a callback that is triggered every time a webrtc channel is opened it is wrapped inside an impl named Peer.This contain a member variable of type i16 named num_channel_opened setted to a default of 0. #[wasm_bindgen] #[derive(Clone)] struct…
JSmith
  • 4,519
  • 4
  • 29
  • 45
0
votes
0 answers

How can I write tests which require functions from npm dependencies?

I'm writing a project with a lot of interop between wasm and JS library from npm called cesium. I am needing to borrow functions back and forth from js. I might even need to re-implement some of these functions inside wasm. I'd like to be able to…
Brandon Piña
  • 614
  • 1
  • 6
  • 20
0
votes
1 answer

fopen function is failed to open existing file in read mode (wasm platform)

I have compiled the following code using the emcc compiler #include #include int main(int argc, char *argv[]) { if(argc > 2 || argc < 2) { printf("\nEnter the name of file \n"); return 0; } FILE…
0
votes
0 answers

How can I override function on a class in wasm_bindgen

I'm trying to write bindings for CustomDataSource from cesium here's what I have so far #[wasm_bindgen(module = "cesium")] extern "C" { pub type CustomDataSource; pub type Event; pub type DataSourceClock; pub type EntityCluster; …
Brandon Piña
  • 614
  • 1
  • 6
  • 20